Class: BraspagRest::Response
- Inherits:
-
Object
- Object
- BraspagRest::Response
- Defined in:
- lib/braspag-rest/response.rb
Instance Attribute Summary collapse
-
#gateway_response ⇒ Object
readonly
Returns the value of attribute gateway_response.
Instance Method Summary collapse
-
#initialize(gateway_response) ⇒ Response
constructor
A new instance of Response.
- #parsed_body ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(gateway_response) ⇒ Response
Returns a new instance of Response.
5 6 7 |
# File 'lib/braspag-rest/response.rb', line 5 def initialize(gateway_response) @gateway_response = gateway_response end |
Instance Attribute Details
#gateway_response ⇒ Object (readonly)
Returns the value of attribute gateway_response.
3 4 5 |
# File 'lib/braspag-rest/response.rb', line 3 def gateway_response @gateway_response end |
Instance Method Details
#parsed_body ⇒ Object
13 14 15 |
# File 'lib/braspag-rest/response.rb', line 13 def parsed_body JSON.parse(@gateway_response.body) rescue {} end |
#success? ⇒ Boolean
9 10 11 |
# File 'lib/braspag-rest/response.rb', line 9 def success? (200..207).include?(@gateway_response.code) rescue false end |