Class: Kontakt::Device

Inherits:
Auth show all
Defined in:
lib/kontakt.rb

Instance Attribute Summary

Attributes inherited from Configuration

#key

Class Method Summary collapse

Methods inherited from Auth

make_request

Methods inherited from Configuration

#initialize

Constructor Details

This class inherits a constructor from Kontakt::Configuration

Class Method Details

.assign_manager(managerId, deviceId) ⇒ Object



93
94
95
# File 'lib/kontakt.rb', line 93

def self.assign_manager(managerId, deviceId)
  return make_request('post', '/device/assign', {}, {:deviceId => deviceId, :managerId => managerId})
end

.assign_venue(venueId, deviceId) ⇒ Object



89
90
91
# File 'lib/kontakt.rb', line 89

def self.assign_venue(venueId, deviceId)
  return make_request('post', '/device/assign', {}, {:venueId => venueId, :deviceId => deviceId})
end

.by_id(id) ⇒ Object



97
98
99
# File 'lib/kontakt.rb', line 97

def self.by_id(id)
  return JSON.parse(make_request('get', '/device/' + id).body)
end

.list(options = {}) ⇒ Object

> Devices / Beacons



79
80
81
82
83
# File 'lib/kontakt.rb', line 79

def self.list(options = {})
  # => managerId needs to be a string separated by comma for more then one
  #  managerIds = array | managerIds.join(',') before passing to Device.list
  return JSON.parse(make_request('get', '/device', {params: options}).body)
end

.status(id) ⇒ Object



101
102
103
# File 'lib/kontakt.rb', line 101

def self.status(id)
  return JSON.parse(make_request('get', '/device/' + id + '/status').body)
end

.unassigned(managerId, options = {}) ⇒ Object



85
86
87
# File 'lib/kontakt.rb', line 85

def self.unassigned(managerId, options = {})
  return JSON.parse(make_request('get', '/device/unassigned/' + managerId, {params: options}).body)
end

.update(id, type, options = {}) ⇒ Object



105
106
107
# File 'lib/kontakt.rb', line 105

def self.update(id, type, options = {})
  return make_request('post', '/device/update', {}, {:uniqueId => id, :deviceType => type}.merge(options))
end