Class: MotionOcean::API::Client::APIResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/motion_ocean/api/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



100
101
102
# File 'lib/motion_ocean/api/client.rb', line 100

def data
  @data
end

#errorObject (readonly)

Returns the value of attribute error.



100
101
102
# File 'lib/motion_ocean/api/client.rb', line 100

def error
  @error
end

#responseObject (readonly)

Returns the value of attribute response.



100
101
102
# File 'lib/motion_ocean/api/client.rb', line 100

def response
  @response
end

#successObject (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

Returns:

  • (Boolean)


109
110
111
# File 'lib/motion_ocean/api/client.rb', line 109

def success?
  @success
end