Class: Stuart::Infrastructure::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/stuart-client-ruby/infrastructure/http_client.rb

Instance Method Summary collapse

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