Class: Mundipagg::Response
- Inherits:
-
Object
- Object
- Mundipagg::Response
- Defined in:
- lib/mundipagg/response.rb
Direct Known Subclasses
Boleto::Response, CreditCard::Response, Mundipagg::Refund::Response
Instance Attribute Summary collapse
-
#body ⇒ Object
(also: #payload)
readonly
Returns the value of attribute body.
Instance Method Summary collapse
- #error ⇒ Object
- #error_item ⇒ Object
-
#initialize(body = {}) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(body = {}) ⇒ Response
Returns a new instance of Response.
7 8 9 |
# File 'lib/mundipagg/response.rb', line 7 def initialize(body = {}) @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly) Also known as: payload
Returns the value of attribute body.
3 4 5 |
# File 'lib/mundipagg/response.rb', line 3 def body @body end |
Instance Method Details
#error ⇒ Object
15 16 17 18 19 |
# File 'lib/mundipagg/response.rb', line 15 def error ::Mundipagg::Error.new error_item[:description], error_item[:error_code] rescue NoMethodError => event ::Mundipagg::Error.new "Unknown error", 0 end |
#error_item ⇒ Object
21 22 23 |
# File 'lib/mundipagg/response.rb', line 21 def error_item raise "Not yet implemented" end |
#success? ⇒ Boolean
11 12 13 |
# File 'lib/mundipagg/response.rb', line 11 def success? payload[:success] end |