Module: Lelylan::Client::Device

Included in:
Lelylan::Client
Defined in:
lib/lelylan/client/device.rb

Instance Method Summary collapse

Instance Method Details

#activate_device(params = {}) ⇒ Object

Public: Activate a device and returns extended information for it.

params - A Hash containing the activation code.

Returns Hashie The activated device.



105
106
107
# File 'lib/lelylan/client/device.rb', line 105

def activate_device(params = {})
  post('/activations', params)
end

#create_device(params = {}) ⇒ Object

Public: Create a device and returns extended information for it.

params - The Hash used to create the resource (default: {}).

Returns Hashie The created device.



45
46
47
# File 'lib/lelylan/client/device.rb', line 45

def create_device(params = {})
  post('/devices', params)
end

#deactivate_device(activation_code) ⇒ Object

Public: Deactivate a device and returns extended information for it.

activation_code - A String that represents the activation_code.

Returns Hashie The activated device.



116
117
118
# File 'lib/lelylan/client/device.rb', line 116

def deactivate_device(activation_code)
  delete("/activations/#{activation_code}")
end

#delete_device(id) ⇒ Object

Public: Delete a device identified from its ID and returns extended information for it.

id - A String that represent the device ID.

Returns Hashie The deleted device.



68
69
70
# File 'lib/lelylan/client/device.rb', line 68

def delete_device(id)
  delete("/devices/#{id}")
end

#device(id) ⇒ Object

Public: Returns extended information for a given device identified from its ID.

id - A String that represent the device ID.

Returns Hashie The device.



12
13
14
# File 'lib/lelylan/client/device.rb', line 12

def device(id)
  get("/devices/#{id}")
end

#device_privates(id) ⇒ Object

Public: Returns extended information for a given device identified from its ID.

id - A String that represent the device ID.

Returns Hashie The device.



23
24
25
# File 'lib/lelylan/client/device.rb', line 23

def device_privates(id)
  get("/devices/#{id}/privates")
end

#device_properties(id, params = {}) ⇒ Object

Public: Update properties on a device identified from its ID and returns extended information for it.

id - A String that represent the device ID. params - An Hash containing the device properties.

Returns Hashie The device with the updated properties.



94
95
96
# File 'lib/lelylan/client/device.rb', line 94

def device_properties(id, params={})
  put("/devices/#{id}/properties", params)
end

#devices(params = {}) ⇒ Object

Public: Returns a list of owned devices.

params - The Hash used to refine the search (default: {}).

Returns Array List of devices.



34
35
36
# File 'lib/lelylan/client/device.rb', line 34

def devices(params = {})
  get('/devices', params)
end

#execute(id, params = {}) ⇒ Object

Public: Execute a function on a device identified from its ID and returns extended information for it.

id - A String that represent the device ID. params - An Hash containing the function to execute and the device properties.

Returns Hashie The device with the updated properties.



81
82
83
# File 'lib/lelylan/client/device.rb', line 81

def execute(id, params={})
  put("/devices/#{id}/functions", params)
end

#update_device(id, params = {}) ⇒ Object

Public: Update a device identified from its ID and returns extended information for it.

id - A String that represent the device ID. params - The Hash used to update the resource (default: {}).

Returns Hashie The updated device.



57
58
59
# File 'lib/lelylan/client/device.rb', line 57

def update_device(id, params = {})
  put("/devices/#{id}", params)
end