module GenesisClient::Devices
Public Instance Methods
Create a new Device.
@return [Hashie::Mash] Hash representing the device @param sku [String] The SKU of the new device @param type [String] The type of device to create
# File lib/genesis_client/devices.rb, line 30 def create_device(sku, type) post('/devices', sku: sku, type: type)['device'] end
Create a new Log for the current Remote Action for a Device.
@return [Hashie::Mash] Hash representing the log @param sku [String] The SKU of the device @param message [String] Log message
# File lib/genesis_client/devices.rb, line 58 def create_device_current_remote_action_log(sku, message) data = { current_action: 'true', log: { message: message } } post("/devices/#{sku}/logs", data) end
Create a new Log for a Device.
@return [Hashie::Mash] Hash representing the log @param sku [String] The SKU of the device @param message [String] Log message
# File lib/genesis_client/devices.rb, line 48 def create_device_log(sku, message) data = { message: message } post("/devices/#{sku}/logs", data)['log'] end
Receive a single Device.
@return [Hashie::Mash] Hash representing the device. @param sku [String] The SKU of the device @example
client = GenesisClient::Client.new client.device('UNK-12345534')
# File lib/genesis_client/devices.rb, line 21 def device(sku) get("/devices/#{sku}")['device'] end
Receive a list of all Devices
.
@return [Array<Hashie::Mash>] Array of hashes representing devices. @example
client = GenesisClient::Client.new client.devices
# File lib/genesis_client/devices.rb, line 9 def devices(type = nil) (type.nil? ? get('/devices') : get("/devices?type=#{type}"))['devices'] end
Modify an existing Device.
@return [Hashie::Mash] Hash representing the device @param sku [String] The SKU of the device @param data [Hash] Device attributes to update
# File lib/genesis_client/devices.rb, line 39 def update_device(sku, data) put("/devices/#{sku}", data)['device'] end