Class: IOTServices::Adapters::JsonResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/iot_services/adapters/json_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, body) ⇒ JsonResponse

Returns a new instance of JsonResponse.



8
9
10
11
# File 'lib/iot_services/adapters/json_response.rb', line 8

def initialize status, body
  @status = status
  @body = JSON.parse(body)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/iot_services/adapters/json_response.rb', line 6

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/iot_services/adapters/json_response.rb', line 6

def status
  @status
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/iot_services/adapters/json_response.rb', line 13

def ok?
  @status == 200
end