{"id":17157254,"url":"https://github.com/corroded/rapier","last_synced_at":"2025-03-24T14:18:50.590Z","repository":{"id":29479839,"uuid":"33016901","full_name":"corroded/rapier","owner":"corroded","description":"A gem to create a Ruby gem wrapper for APIs","archived":false,"fork":false,"pushed_at":"2015-03-28T01:28:17.000Z","size":104,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T19:14:18.278Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/corroded.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-28T01:27:31.000Z","updated_at":"2015-03-28T01:28:17.000Z","dependencies_parsed_at":"2022-08-27T05:52:40.118Z","dependency_job_id":null,"html_url":"https://github.com/corroded/rapier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corroded%2Frapier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corroded%2Frapier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corroded%2Frapier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corroded%2Frapier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corroded","download_url":"https://codeload.github.com/corroded/rapier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245284730,"owners_count":20590307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T22:08:41.832Z","updated_at":"2025-03-24T14:18:50.569Z","avatar_url":"https://github.com/corroded.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rapier\n\nThis gem can be used to bootstrap a Ruby gem wrapper for your (or someone else's) API.\nUsually, most services open their API to the public with no Ruby gem wrapper for it. If you wanted to use their API,\nyou would either wait for someone to do it, or do it yourself.\n\nIf you want to go the DIY route, then this gem is for you!\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rapier'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rapier\n\n## Usage\n\nTo start, create your gem first (this example uses bundler) by executing:\n\n`bundle gem \u003cgem name\u003e`\n\n`cd` to your gem's folder and from there, you can start using rapier to assist you in making your gem.\n\n### Setting up\n\nTo start, just execute:\n\n`rapier start http://somesite.com/v1/api`\n\nThis creates a config file in your current folder (hopefully you did this while in your project folder) named `.rapier.yml` and also inserts the dependencies in your project gemspec.\n\nRapier isn't included in the dependencies but [httparty](https://github.com/jnunemaker/httparty) and [thor](https://github.com/erikhuda/thor) are.\n\n### Adding an API endpoint\n\nSay you are creating a gem for a site that sells products. Given this API endpoint:\n\n    http://somesite.com/\n\nYou can do:\n\n`rapier endpoint products`\n\nand it will generate a simple bootstrap of files that will get you started in making your API wrapper.\n\nThis creates a file in `lib/yourgemname/products.rb` which just contains:\n\n````\nmodule YourGemName\n  module Product\n    include HTTParty\n    base_uri \"somesite.com\"\n    \n    def self.products\n      get('/products')\n    end\n  end\nend\n````\n\n#### Adding endpoints with arguments\n\nIf your endpoint has arguments, like `somesite.com/products/4`, you can add the argument/s after the command like so:\n\nExamples:\n\n`rapier endpoint products id`\n\n`rapier endpoint products id quantity`\n\nThis just creates the same class but with additional provisions for the arguments:\n\n````\nmodule YourGemName\n  module Product\n    include HTTParty\n    base_uri \"somesite.com\"\n    \n    def initialize(id=nil, quantity=nil)\n      if id || quantity\n\t     @options = {query: {id: id, quantity: quantity}}\n\t   end\n    end\n    \n    def self.products\n      get('/products', @options)\n    end\n  end\nend\n````\n\n### Adding multiple endpoints\n\nYou can also add multiple `GET` endpoints via the `endpoints` command:\n\n`rapier endpoints posts authors comments`\n\nThis is just a convenience call instead of calling `rapier endpoint` for each of the three endpoints.\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\n1. Fork it ( https://github.com/[my-github-username]/rapier/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorroded%2Frapier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorroded%2Frapier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorroded%2Frapier/lists"}