EzClient
EzClient is HTTP gem wrapper for easy persistent connections and more.
Installation
Add this line to your application's Gemfile:
gem "ezclient"
gem "http", github: "httprb/http"
Usage
client = EzClient.new()
client.perform!(:get, "https://example.com", params: { a: 1 })
# Performs a GET request to https://example.com/?a=1
Valid client options are:
api_auth– arguments forApiAuth.sign!keep_alive– timeout for persitent connectionmax_retries– max number of retries in case of errorson_complete– callback called on request completionon_error– callback called on request exceptionretry_exceptions– exception classes to retryssl_context– ssl context for requeststimeout– timeout for requests
Extra request options are:
params– becomesqueryfor GET andformfor other requestsquery– hash for uri queryform– hash for urlencoded bodybody– raw bodyjson– data for jsonheaders– headers for request
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/ezclient.
License
The gem is available as open source under the terms of the MIT License.