module Helium::Client::DeviceConfigurations
Public Instance Methods
create_device_configuration(device, configuration)
click to toggle source
# File lib/helium/client/device_configurations.rb, line 35 def create_device_configuration(device, configuration) path = "/device-configuration" body = { data: { type: "device-configuration", relationships: { configuration: { data: { id: configuration.id, type: configuration.type } }, device: { data: { id: device.id, type: device.type } } } } } response = post(path, body: body) dc = JSON.parse(response.body)["data"] return DeviceConfiguration.new(client: self, params: dc) end
device_configuration(id)
click to toggle source
# File lib/helium/client/device_configurations.rb, line 9 def device_configuration(id) DeviceConfiguration.find(id, client: self) end
device_configuration_configuration(device_config)
click to toggle source
# File lib/helium/client/device_configurations.rb, line 13 def device_configuration_configuration(device_config) path = "/device-configuration/#{device_config.id}/configuration" response = get(path) configj = JSON.parse(response.body)["data"] config = Configuration.new(client: self, params: configj) return config end
device_configuration_device(device_config)
click to toggle source
# File lib/helium/client/device_configurations.rb, line 21 def device_configuration_device(device_config) path = "/device-configuration/#{device_config.id}/device" response = get(path) configj = JSON.parse(response.body)["data"] if configj.dig("type") == "sensor" device = Sensor.new(client: self, params: configj) elsif configj.dig("type") == "element" device = Element.new(client: self, params: configj) end return device end
device_configurations()
click to toggle source
# File lib/helium/client/device_configurations.rb, line 5 def device_configurations DeviceConfiguration.all(client: self) end