Class: TuyaCloud::Device::Control

Inherits:
Object
  • Object
show all
Defined in:
lib/tuya_cloud/device.rb

Direct Known Subclasses

Scene, Switchable

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json, auth_context) ⇒ Control

Returns a new instance of Control.



35
36
37
38
# File 'lib/tuya_cloud/device.rb', line 35

def initialize(json, auth_context)
  self.id = json['id']
  self.auth_context = auth_context
end

Instance Attribute Details

#auth_contextObject

Returns the value of attribute auth_context.



32
33
34
# File 'lib/tuya_cloud/device.rb', line 32

def auth_context
  @auth_context
end

#idObject

Returns the value of attribute id.



32
33
34
# File 'lib/tuya_cloud/device.rb', line 32

def id
  @id
end

Instance Method Details

#process_request(name, payload: {}) ⇒ Object



40
41
42
43
44
# File 'lib/tuya_cloud/device.rb', line 40

def process_request(name, payload: {})
  auth_context.process_request(name, 'control',
                               device_id: id,
                               payload: payload)
end