Class: PlayWhe::HTTP::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/playwhe/http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_client) ⇒ Adapter

Returns a new instance of Adapter.



28
29
30
# File 'lib/playwhe/http.rb', line 28

def initialize(http_client)
  @http_client = http_client
end

Instance Attribute Details

#http_clientObject (readonly)

Returns the value of attribute http_client.



26
27
28
# File 'lib/playwhe/http.rb', line 26

def http_client
  @http_client
end

Instance Method Details

#post(url, data) ⇒ Object



32
33
34
35
36
# File 'lib/playwhe/http.rb', line 32

def post(url, data)
  Response.new http_client.post(url, form: data)
rescue ::HTTP::Error
  raise PlayWhe::NetworkError
end