Class: Yodlicious::Response
- Inherits:
-
Object
- Object
- Yodlicious::Response
- Defined in:
- lib/yodlicious/response.rb
Instance Method Summary collapse
- #body ⇒ Object
- #error ⇒ Object
- #fail? ⇒ Boolean
-
#initialize(body) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(body) ⇒ Response
Returns a new instance of Response.
4 5 6 |
# File 'lib/yodlicious/response.rb', line 4 def initialize body @body = body end |
Instance Method Details
#body ⇒ Object
16 17 18 |
# File 'lib/yodlicious/response.rb', line 16 def body @body end |
#error ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/yodlicious/response.rb', line 20 def error if body.kind_of?(Hash) if body.has_key?('Error') body['Error'][0]['errorDetail'] elsif body['errorOccurred'] == 'true' body['exceptionType'] end end end |
#fail? ⇒ Boolean
12 13 14 |
# File 'lib/yodlicious/response.rb', line 12 def fail? body.kind_of?(Hash) && (body['errorOccurred'] == 'true' || body.has_key?('Error')) end |
#success? ⇒ Boolean
8 9 10 |
# File 'lib/yodlicious/response.rb', line 8 def success? !fail? end |