module GenesisClient::Devices

Public Instance Methods

create_device(sku, type) click to toggle source

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_device_current_remote_action_log(sku, message) click to toggle source

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_device_log(sku, message) click to toggle source

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
device(sku) click to toggle source

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
devices(type = nil) click to toggle source

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
Also aliased as: list_devices
list_devices(type = nil)
Alias for: devices
update_device(sku, data) click to toggle source

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