Class: ConnectorKit::HTTPClient
- Inherits:
-
Object
- Object
- ConnectorKit::HTTPClient
- Includes:
- HTTParty
- Defined in:
- lib/connector_kit/httpclient.rb
Overview
Simple HTTP client wrapper for HTTParty
Instance Method Summary collapse
- #get(url, response_mapper) ⇒ Object
-
#initialize(target_uri) ⇒ HTTPClient
constructor
A new instance of HTTPClient.
Constructor Details
#initialize(target_uri) ⇒ HTTPClient
Returns a new instance of HTTPClient.
10 11 12 |
# File 'lib/connector_kit/httpclient.rb', line 10 def initialize(target_uri) self.class.base_uri(target_uri) end |
Instance Method Details
#get(url, response_mapper) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/connector_kit/httpclient.rb', line 14 def get(url, response_mapper) response = self.class.get(url) raise make_api_error(response) unless response.code == 200 response_mapper.map(response.parsed_response['data']) end |