Class: AlfaInsurance::Response
- Inherits:
-
Object
- Object
- AlfaInsurance::Response
- Defined in:
- lib/alfa_insurance/response.rb
Direct Known Subclasses
Instance Method Summary collapse
- #body ⇒ Object
- #error_code ⇒ Object
- #error_description ⇒ Object
-
#initialize(soap_response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(soap_response) ⇒ Response
Returns a new instance of Response.
3 4 5 |
# File 'lib/alfa_insurance/response.rb', line 3 def initialize(soap_response) @raw_response = soap_response end |
Instance Method Details
#body ⇒ Object
19 20 21 |
# File 'lib/alfa_insurance/response.rb', line 19 def body @body ||= @raw_response.body.values.first end |
#error_code ⇒ Object
11 12 13 |
# File 'lib/alfa_insurance/response.rb', line 11 def error_code body.dig(:return_code, :code) unless success? end |
#error_description ⇒ Object
15 16 17 |
# File 'lib/alfa_insurance/response.rb', line 15 def error_description body.dig(:return_code, :error_message) unless success? end |
#success? ⇒ Boolean
7 8 9 |
# File 'lib/alfa_insurance/response.rb', line 7 def success? body.dig(:return_code, :code) == 'OK' end |