Class: HaveAPI::Client::Response
- Inherits:
-
Object
- Object
- HaveAPI::Client::Response
- Defined in:
- lib/haveapi/client/response.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
Instance Method Summary collapse
- #errors ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(action, response) ⇒ Response
constructor
A new instance of Response.
- #message ⇒ Object
- #ok? ⇒ Boolean
- #response ⇒ Object
Constructor Details
#initialize(action, response) ⇒ Response
4 5 6 7 |
# File 'lib/haveapi/client/response.rb', line 4 def initialize(action, response) @action = action @response = response end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
2 3 4 |
# File 'lib/haveapi/client/response.rb', line 2 def action @action end |
Instance Method Details
#errors ⇒ Object
30 31 32 |
# File 'lib/haveapi/client/response.rb', line 30 def errors @response[:errors] end |
#failed? ⇒ Boolean
13 14 15 |
# File 'lib/haveapi/client/response.rb', line 13 def failed? !ok? end |
#message ⇒ Object
26 27 28 |
# File 'lib/haveapi/client/response.rb', line 26 def @response[:message] end |
#ok? ⇒ Boolean
9 10 11 |
# File 'lib/haveapi/client/response.rb', line 9 def ok? @response[:status] end |
#response ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/haveapi/client/response.rb', line 17 def response case @action.layout.to_sym when :object, :list @response[:response][@action.namespace(:output).to_sym] else @response[:response] end end |