Class: MotionOcean::API::Client::APIResponse
- Inherits:
-
Object
- Object
- MotionOcean::API::Client::APIResponse
- Defined in:
- lib/motion_ocean/api/client.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
Instance Method Summary collapse
-
#initialize(data, response, error) ⇒ APIResponse
constructor
A new instance of APIResponse.
- #success? ⇒ Boolean
Constructor Details
#initialize(data, response, error) ⇒ APIResponse
Returns a new instance of APIResponse.
102 103 104 105 106 107 |
# File 'lib/motion_ocean/api/client.rb', line 102 def initialize(data, response, error) @success = (200...300).include?(response.statusCode) if response @data = NSJSONSerialization.JSONObjectWithData(data, options: 0, error: nil) @response = response @error = error end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
100 101 102 |
# File 'lib/motion_ocean/api/client.rb', line 100 def data @data end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
100 101 102 |
# File 'lib/motion_ocean/api/client.rb', line 100 def error @error end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
100 101 102 |
# File 'lib/motion_ocean/api/client.rb', line 100 def response @response end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
100 101 102 |
# File 'lib/motion_ocean/api/client.rb', line 100 def success @success end |
Instance Method Details
#success? ⇒ Boolean
109 110 111 |
# File 'lib/motion_ocean/api/client.rb', line 109 def success? @success end |