ExternalApiService
Installation
Add this line to your application's Gemfile:
gem 'external_api_service'
And then execute:
$ bundle
Or install it yourself as:
$ gem install external_api_service
Usage
To use, you need to require the service module wherever you are wanting to use it:
require
To make a GET request, you need an endpoint (required), and any query params in a Hash (optional). The endpoint must return JSON.
It will work with HTTPS or HTTP. Call get_service:
# no params
url =
get_service will transform the JSON to Ruby Hash with symbolized names:
# First entry from the Chicago Problem Landlord List in Array of Hashes (“https://data.cityofchicago.org/Buildings/Problem-Landlord-List-Map/dip3-ud6z”)
[{:respondent=>
Features To-Do
Does not support JSONP.
Only makes GET requests. Probably need to update to make POST requests as well.
Contributing
- Fork it ( https://github.com/[my-github-username]/external_api_service/fork )
- 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 a new Pull Request