Module: GenesisClient::Devices
- Included in:
- Client
- Defined in:
- lib/genesis_client/devices.rb
Instance Method Summary collapse
-
#create_device(sku, type) ⇒ Hashie::Mash
Create a new Device.
-
#create_device_current_remote_action_log(sku, message) ⇒ Hashie::Mash
Create a new Log for the current Remote Action for a Device.
-
#create_device_log(sku, message) ⇒ Hashie::Mash
Create a new Log for a Device.
-
#device(sku) ⇒ Hashie::Mash
Receive a single Device.
-
#devices(type = nil) ⇒ Array<Hashie::Mash>
(also: #list_devices)
Receive a list of all Devices.
-
#update_device(sku, data) ⇒ Hashie::Mash
Modify an existing Device.
Instance Method Details
#create_device(sku, type) ⇒ Hashie::Mash
Create a new Device.
30 31 32 |
# File 'lib/genesis_client/devices.rb', line 30 def create_device(sku, type) post('/devices', sku: sku, type: type)['device'] end |
#create_device_current_remote_action_log(sku, message) ⇒ Hashie::Mash
Create a new Log for the current Remote Action for a Device.
58 59 60 61 |
# File 'lib/genesis_client/devices.rb', line 58 def create_device_current_remote_action_log(sku, ) data = { current_action: 'true', log: { message: } } post("/devices/#{sku}/logs", data)['log'] end |
#create_device_log(sku, message) ⇒ Hashie::Mash
Create a new Log for a Device.
48 49 50 51 |
# File 'lib/genesis_client/devices.rb', line 48 def create_device_log(sku, ) data = { message: } post("/devices/#{sku}/logs", data)['log'] end |
#device(sku) ⇒ Hashie::Mash
Receive a single Device.
21 22 23 |
# File 'lib/genesis_client/devices.rb', line 21 def device(sku) get("/devices/#{sku}")['device'] end |
#devices(type = nil) ⇒ Array<Hashie::Mash> Also known as: list_devices
Receive a list of all Devices.
9 10 11 |
# File 'lib/genesis_client/devices.rb', line 9 def devices(type = nil) (type.nil? ? get('/devices') : get("/devices?type=#{type}"))['devices'] end |
#update_device(sku, data) ⇒ Hashie::Mash
Modify an existing Device.
39 40 41 |
# File 'lib/genesis_client/devices.rb', line 39 def update_device(sku, data) put("/devices/#{sku}", data)['device'] end |