Class: Stuart::Infrastructure::HttpClient
- Inherits:
-
Object
- Object
- Stuart::Infrastructure::HttpClient
- Defined in:
- lib/stuart-client-ruby/infrastructure/http_client.rb
Instance Method Summary collapse
-
#initialize(authenticator) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #perform_get(resource) ⇒ Object
- #perform_post(resource, body) ⇒ Object
Constructor Details
#initialize(authenticator) ⇒ HttpClient
Returns a new instance of HttpClient.
7 8 9 |
# File 'lib/stuart-client-ruby/infrastructure/http_client.rb', line 7 def initialize(authenticator) @authenticator = authenticator end |
Instance Method Details
#perform_get(resource) ⇒ Object
11 12 13 |
# File 'lib/stuart-client-ruby/infrastructure/http_client.rb', line 11 def perform_get(resource) to_api_response Typhoeus.get(url(resource), headers: default_header) end |
#perform_post(resource, body) ⇒ Object
15 16 17 |
# File 'lib/stuart-client-ruby/infrastructure/http_client.rb', line 15 def perform_post(resource, body) to_api_response Typhoeus.post(url(resource), headers: default_header, body: body) end |