Class: WirecardCheckoutPage::Toolkit::Response
- Inherits:
-
Object
- Object
- WirecardCheckoutPage::Toolkit::Response
- Defined in:
- lib/wirecard_checkout_page/toolkit/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#original_response ⇒ Object
readonly
Returns the value of attribute original_response.
Class Method Summary collapse
Instance Method Summary collapse
- #error_code ⇒ Object
-
#initialize(body, original_response: nil) ⇒ Response
constructor
A new instance of Response.
- #order_number ⇒ Object
- #params ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(body, original_response: nil) ⇒ Response
Returns a new instance of Response.
10 11 12 13 |
# File 'lib/wirecard_checkout_page/toolkit/response.rb', line 10 def initialize(body, original_response: nil) @body = body @original_response = original_response end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
17 18 19 |
# File 'lib/wirecard_checkout_page/toolkit/response.rb', line 17 def body @body end |
#original_response ⇒ Object (readonly)
Returns the value of attribute original_response.
15 16 17 |
# File 'lib/wirecard_checkout_page/toolkit/response.rb', line 15 def original_response @original_response end |
Class Method Details
.from_typhoeus_response(response) ⇒ Object
6 7 8 |
# File 'lib/wirecard_checkout_page/toolkit/response.rb', line 6 def self.from_typhoeus_response(response) new(response.body, original_response: response) end |
Instance Method Details
#error_code ⇒ Object
23 24 25 |
# File 'lib/wirecard_checkout_page/toolkit/response.rb', line 23 def error_code param('errorCode').to_s end |
#order_number ⇒ Object
27 28 29 |
# File 'lib/wirecard_checkout_page/toolkit/response.rb', line 27 def order_number param('orderNumber').to_i end |
#params ⇒ Object
31 32 33 |
# File 'lib/wirecard_checkout_page/toolkit/response.rb', line 31 def params { payment_url: original_response.headers['Location'] } end |
#success? ⇒ Boolean
19 20 21 |
# File 'lib/wirecard_checkout_page/toolkit/response.rb', line 19 def success? status == '0' end |