Class: Guh::State
Overview
This class wraps everything related to the state of a device.
Class Method Summary collapse
Methods inherited from Base
configure, get, guh_ip_address, guh_ip_address=, guh_port, guh_port=, introspect, version
Class Method Details
.all(device_id) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/guh/state.rb', line 18 def self.all(device_id) device = Guh::Device.find(device_id) state_types = Guh::StateType.all(device['deviceClassId']) values = [] state_types.each do |state| value = state value['value'] = Guh::State.find(device_id, state['id']) values << value end return values end |
.find(device_id, state_id) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/guh/state.rb', line 7 def self.find(device_id, state_id) get({ id: generate_request_id, method: 'Devices.GetStateValue', params: { deviceId: device_id, stateTypeId: state_id } }) end |