class Ari::DeviceState

Attributes

name[R]
state[R]

Public Class Methods

delete(options = {}) click to toggle source

DELETE /deviceStates/%{deviceName}

Device state

Parameters:

deviceName (required) - Name of the device

# File lib/ari/resources/device_state.rb, line 80
def self.delete(options = {})
  raise ArgumentError.new("Parameter deviceName must be passed in options hash.") unless options[:deviceName]
  path = '/deviceStates/%{deviceName}' % options
  response = client(options).delete(path, options)
rescue Ari::RequestError => e
  raise unless e.code == '404'
end
get(options = {}) click to toggle source

GET /deviceStates/%{deviceName}

Device state

Parameters:

deviceName (required) - Name of the device

# File lib/ari/resources/device_state.rb, line 38
def self.get(options = {})
  raise ArgumentError.new("Parameter deviceName must be passed in options hash.") unless options[:deviceName]
  path = '/deviceStates/%{deviceName}' % options
  response = client(options).get(path, options)
  DeviceState.new(response.merge(client: options[:client]))
end
list(options = {}) click to toggle source

GET /deviceStates

Device states

# File lib/ari/resources/device_state.rb, line 23
def self.list(options = {})
  path = '/deviceStates'
  response = client(options).get(path, options)
  response.map { |hash| DeviceState.new(hash.merge(client: options[:client])) }
end
update(options = {}) click to toggle source

PUT /deviceStates/%{deviceName}

Device state

Change the state of a device controlled by ARI. (Note - implicitly creates the d

Parameters:

deviceName (required) - Name of the device deviceState (required) - Device state value

# File lib/ari/resources/device_state.rb, line 60
def self.update(options = {})
  raise ArgumentError.new("Parameter deviceName must be passed in options hash.") unless options[:deviceName]
  raise ArgumentError.new("Parameter deviceState must be passed in options hash.") unless options[:deviceState]
  path = '/deviceStates/%{deviceName}' % options
  response = client(options).put(path, options)
end

Public Instance Methods

delete(options = {}) click to toggle source
# File lib/ari/resources/device_state.rb, line 88
def delete(options = {})
  self.class.delete(options.merge(deviceStateId: self.id, client: @client))
end
get(options = {}) click to toggle source
# File lib/ari/resources/device_state.rb, line 45
def get(options = {})
  self.class.get(options.merge(deviceStateId: self.id, client: @client))
end
update(options = {}) click to toggle source
# File lib/ari/resources/device_state.rb, line 67
def update(options = {})
  self.class.update(options.merge(deviceStateId: self.id, client: @client))
end