Class: PlayWhe::HTTP::Adapter
- Inherits:
-
Object
- Object
- PlayWhe::HTTP::Adapter
- Defined in:
- lib/playwhe/http.rb
Instance Attribute Summary collapse
-
#http_client ⇒ Object
readonly
Returns the value of attribute http_client.
Instance Method Summary collapse
-
#initialize(http_client) ⇒ Adapter
constructor
A new instance of Adapter.
- #post(url, data) ⇒ Object
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_client ⇒ Object (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 |