rest_baby
Small rest client, supports ruby-2.0.0, ruby-2.1.0, and ruby-2.2.0. You can only run reek with ruby 2.1 or above. You could use jruby but some develop dependencies are not supported any longer, including coveralls and yard-cucumber.
Item | Status |
---|---|
Gem | |
Dependencies | |
Build/Test | |
Coverage | |
Code Analysis | |
Docs | |
codeship |
Purpose
Rest_baby is a rest client that retains key server & authorization settings, keeping your code dryer. It has been used for automated tools that test restful interfaces. It has grown to over 5k downloads with only 5 reported issues as of this writing.
Installation
Add this line to your application's Gemfile:
gem 'rest_baby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rest_baby
Use
client = RestBaby::Client.new('http://gis.srh.noaa.gov/arcgis/rest/services/System')
# get(HEADERS, PATH, PARAMETERS)
# returns http response, usually the body is what is wanted.
message = JSON.parse(client.get( { 'Accept' => 'application/json' },
'/ReportingTools/GPServer/info/iteminfo',
{'f' => 'pjson'}).body)
client = RestBaby::Client.new('http://127.0.0.1:9001')
# post(BODY, HEADERS, PATH)
message = JSON.parse(client.post('{ "name": "Ben Franklin" }',
{ 'Content-Type' => 'application/json' },
'/person').body)
# or
message = JSON.parse(client.post({ "name" => "Ben Franklin" }.to_json,
{ 'Content-Type' => 'application/json' },
'/person').body)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request