Module: GenesisClient::Devices
- Included in:
- Client
- Defined in:
- lib/genesis_client/devices.rb
Instance Method Summary collapse
-
#create_device(sku) ⇒ 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) ⇒ Hashie::Mash
Create a new Device.
29 30 31 |
# File 'lib/genesis_client/devices.rb', line 29 def create_device(sku) post('/devices', sku: sku)['device'] end |
#create_device_current_remote_action_log(sku, message) ⇒ Hashie::Mash
Create a new Log for the current Remote Action for a Device.
57 58 59 60 |
# File 'lib/genesis_client/devices.rb', line 57 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.
47 48 49 50 |
# File 'lib/genesis_client/devices.rb', line 47 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.
38 39 40 |
# File 'lib/genesis_client/devices.rb', line 38 def update_device(sku, data) put("/devices/#{sku}", data)['device'] end |