Class: Twib::Response
- Inherits:
-
Object
- Object
- Twib::Response
- Defined in:
- lib/twib.rb
Overview
A response from either twibd or a remote device.
Instance Attribute Summary collapse
-
#device_id ⇒ Object
readonly
Returns the value of attribute device_id.
-
#object_id ⇒ Object
readonly
Returns the value of attribute object_id.
-
#object_ids ⇒ Object
readonly
Returns the value of attribute object_ids.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#result_code ⇒ Object
readonly
Returns the value of attribute result_code.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
-
#assert_ok ⇒ self
Raises a ResultError if the #result_code is not OK.
-
#initialize(device_id, object_id, result_code, tag, payload, object_ids) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(device_id, object_id, result_code, tag, payload, object_ids) ⇒ Response
Returns a new instance of Response.
31 32 33 34 35 36 37 38 |
# File 'lib/twib.rb', line 31 def initialize(device_id, object_id, result_code, tag, payload, object_ids) @device_id = device_id @object_id = object_id @result_code = result_code @tag = tag @payload = payload @object_ids = object_ids end |
Instance Attribute Details
#device_id ⇒ Object (readonly)
Returns the value of attribute device_id.
40 41 42 |
# File 'lib/twib.rb', line 40 def device_id @device_id end |
#object_id ⇒ Object (readonly)
Returns the value of attribute object_id.
40 41 42 |
# File 'lib/twib.rb', line 40 def object_id @object_id end |
#object_ids ⇒ Object (readonly)
Returns the value of attribute object_ids.
40 41 42 |
# File 'lib/twib.rb', line 40 def object_ids @object_ids end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
40 41 42 |
# File 'lib/twib.rb', line 40 def payload @payload end |
#result_code ⇒ Object (readonly)
Returns the value of attribute result_code.
40 41 42 |
# File 'lib/twib.rb', line 40 def result_code @result_code end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
40 41 42 |
# File 'lib/twib.rb', line 40 def tag @tag end |
Instance Method Details
#assert_ok ⇒ self
Raises a Twib::ResultError if the #result_code is not OK.
45 46 47 48 49 50 |
# File 'lib/twib.rb', line 45 def assert_ok if @result_code != 0 then raise ResultError.new(@result_code) end return self end |