Class: Tappay::Client
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #post(url, data) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/tappay/client.rb', line 10 def initialize( = {}) = @timeout = .fetch(:timeout, 25) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/tappay/client.rb', line 8 def end |
Instance Method Details
#post(url, data) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tappay/client.rb', line 15 def post(url, data) @response = self.class.post( url, body: data.to_json, headers: headers, timeout: timeout ) validate_response @response rescue HTTParty::Error, Timeout::Error, Net::OpenTimeout => e raise ConnectionError, "HTTP Request failed: #{e.message}" end |