Class: AwsAgcod::Response
- Inherits:
-
Object
- Object
- AwsAgcod::Response
- Defined in:
- lib/aws_agcod/response.rb
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #error_message ⇒ Object
-
#initialize(raw_json) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(raw_json) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 14 15 |
# File 'lib/aws_agcod/response.rb', line 7 def initialize(raw_json) @payload = JSON.parse(raw_json) # All status: # SUCCESS -- Operation succeeded # FAILURE -- Operation failed # RESEND -- A temporary/recoverable system failure that can be resolved by the partner retrying the request @status = payload["status"] ? payload["status"] : payload["agcodResponse"]["status"] end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
5 6 7 |
# File 'lib/aws_agcod/response.rb', line 5 def payload @payload end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/aws_agcod/response.rb', line 5 def status @status end |
Instance Method Details
#error_message ⇒ Object
21 22 23 |
# File 'lib/aws_agcod/response.rb', line 21 def "#{payload["errorCode"]} #{payload["errorType"]} - #{payload["message"]}" end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/aws_agcod/response.rb', line 17 def success? status == "SUCCESS" end |