Call APIs safely.
GET
ApiCaller.get(uri_string: 'www.my_api.com/v1/interesting_stuffs.json', logger: Rails.logger)
POST required arguments
ApiCaller.post(uri_string: 'www.my_api.com/v1/interesting_stuffs', params: '{"key": "value"}')
or with optional arguments
ApiCaller.post(uri_string: 'www.my_api.com/v1/interesting_stuffs', params: '{"key": "value"}', content_type: {'Content-Type' => 'application/json'}, logger: Rails.logger)
DELETE
ApiCaller.delete(uri_string: 'www.my_api.com/v1/resource/to-delete', logger: Rails.logger)
Edit your Gemfile and add:
gem 'api_caller'
The gem api_caller is released under the MIT License.
Team Nautilus