Class: PagSeguro::PaymentRequest::Response
- Inherits:
-
Object
- Object
- PagSeguro::PaymentRequest::Response
- Extended by:
- Forwardable
- Defined in:
- lib/pagseguro/payment_request/response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#api_version ⇒ Object
Default PagSeguro API version for payments.
- #code ⇒ Object
- #created_at ⇒ Object
- #errors ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #url ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
9 10 11 |
# File 'lib/pagseguro/payment_request/response.rb', line 9 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/pagseguro/payment_request/response.rb', line 7 def response @response end |
Instance Method Details
#api_version ⇒ Object
Default PagSeguro API version for payments
30 31 32 |
# File 'lib/pagseguro/payment_request/response.rb', line 30 def api_version 'v2' end |
#code ⇒ Object
21 22 23 |
# File 'lib/pagseguro/payment_request/response.rb', line 21 def code @code ||= response.data.css("checkout > code").text if success? end |
#created_at ⇒ Object
25 26 27 |
# File 'lib/pagseguro/payment_request/response.rb', line 25 def created_at @created_at ||= Time.parse(response.data.css("checkout > date").text) if success? end |