Class: MistApi::WebhookDiscoveredRawRssiEvent

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/webhook_discovered_raw_rssi_event.rb

Overview

WebhookDiscoveredRawRssiEvent Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(beam = nil, device_id = nil, mac = nil, map_id = nil, org_id = nil, rssi = nil, site_id = nil, ap_loc = SKIP, ibeacon_major = SKIP, ibeacon_minor = SKIP, ibeacon_uuid = SKIP, is_asset = SKIP, mfg_company_id = SKIP, mfg_data = SKIP, service_packets = SKIP, timestamp = SKIP) ⇒ WebhookDiscoveredRawRssiEvent

Returns a new instance of WebhookDiscoveredRawRssiEvent.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 122

def initialize(beam = nil, device_id = nil, mac = nil, map_id = nil,
               org_id = nil, rssi = nil, site_id = nil, ap_loc = SKIP,
               ibeacon_major = SKIP, ibeacon_minor = SKIP,
               ibeacon_uuid = SKIP, is_asset = SKIP, mfg_company_id = SKIP,
               mfg_data = SKIP, service_packets = SKIP, timestamp = SKIP)
  @ap_loc = ap_loc unless ap_loc == SKIP
  @beam = beam
  @device_id = device_id
  @ibeacon_major = ibeacon_major unless ibeacon_major == SKIP
  @ibeacon_minor = ibeacon_minor unless ibeacon_minor == SKIP
  @ibeacon_uuid = ibeacon_uuid unless ibeacon_uuid == SKIP
  @is_asset = is_asset unless is_asset == SKIP
  @mac = mac
  @map_id = map_id
  @mfg_company_id = mfg_company_id unless mfg_company_id == SKIP
  @mfg_data = mfg_data unless mfg_data == SKIP
  @org_id = org_id
  @rssi = rssi
  @service_packets = service_packets unless service_packets == SKIP
  @site_id = site_id
  @timestamp = timestamp unless timestamp == SKIP
end

Instance Attribute Details

#ap_locArray[Float]

coordinates (if any) of reporting AP (updated once in 60s per client)

Returns:

  • (Array[Float])


14
15
16
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 14

def ap_loc
  @ap_loc
end

#beamInteger

Antenna index, from 1-8, clock-wise starting from the LED

Returns:

  • (Integer)


18
19
20
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 18

def beam
  @beam
end

#device_idUUID | String

Device id of the reporting AP

Returns:

  • (UUID | String)


22
23
24
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 22

def device_id
  @device_id
end

#ibeacon_majorInteger

Major number for iBeacon

Returns:

  • (Integer)


26
27
28
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 26

def ibeacon_major
  @ibeacon_major
end

#ibeacon_minorInteger

Minor number for iBeacon

Returns:

  • (Integer)


30
31
32
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 30

def ibeacon_minor
  @ibeacon_minor
end

#ibeacon_uuidUUID | String

Minor number for iBeacon

Returns:

  • (UUID | String)


34
35
36
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 34

def ibeacon_uuid
  @ibeacon_uuid
end

#is_assetTrueClass | FalseClass

Minor number for iBeacon

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 38

def is_asset
  @is_asset
end

#macString

MAC of the asset/ beacon

Returns:

  • (String)


42
43
44
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 42

def mac
  @mac
end

#map_idUUID | String

MAC of the asset/ beacon

Returns:

  • (UUID | String)


46
47
48
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 46

def map_id
  @map_id
end

#mfg_company_idString

BLE manufacturing company ID

Returns:

  • (String)


50
51
52
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 50

def mfg_company_id
  @mfg_company_id
end

#mfg_dataString

BLE manufacturing data in hex byte-string format (ie: “112233AABBCC”)

Returns:

  • (String)


54
55
56
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 54

def mfg_data
  @mfg_data
end

#org_idUUID | String

BLE manufacturing data in hex byte-string format (ie: “112233AABBCC”)

Returns:

  • (UUID | String)


58
59
60
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 58

def org_id
  @org_id
end

#rssiFloat

Signal strength

Returns:

  • (Float)


62
63
64
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 62

def rssi
  @rssi
end

#service_packetsArray[ServicePacket]

List of service data packets heard from the asset/ beacon

Returns:



66
67
68
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 66

def service_packets
  @service_packets
end

#site_idUUID | String

List of service data packets heard from the asset/ beacon

Returns:

  • (UUID | String)


70
71
72
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 70

def site_id
  @site_id
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


74
75
76
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 74

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 146

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  beam = hash.key?('beam') ? hash['beam'] : nil
  device_id = hash.key?('device_id') ? hash['device_id'] : nil
  mac = hash.key?('mac') ? hash['mac'] : nil
  map_id = hash.key?('map_id') ? hash['map_id'] : nil
  org_id = hash.key?('org_id') ? hash['org_id'] : nil
  rssi = hash.key?('rssi') ? hash['rssi'] : nil
  site_id = hash.key?('site_id') ? hash['site_id'] : nil
  ap_loc = hash.key?('ap_loc') ? hash['ap_loc'] : SKIP
  ibeacon_major = hash.key?('ibeacon_major') ? hash['ibeacon_major'] : SKIP
  ibeacon_minor = hash.key?('ibeacon_minor') ? hash['ibeacon_minor'] : SKIP
  ibeacon_uuid = hash.key?('ibeacon_uuid') ? hash['ibeacon_uuid'] : SKIP
  is_asset = hash.key?('is_asset') ? hash['is_asset'] : SKIP
  mfg_company_id =
    hash.key?('mfg_company_id') ? hash['mfg_company_id'] : SKIP
  mfg_data = hash.key?('mfg_data') ? hash['mfg_data'] : SKIP
  # Parameter is an array, so we need to iterate through it
  service_packets = nil
  unless hash['service_packets'].nil?
    service_packets = []
    hash['service_packets'].each do |structure|
      service_packets << (ServicePacket.from_hash(structure) if structure)
    end
  end

  service_packets = SKIP unless hash.key?('service_packets')
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP

  # Create object from extracted values.
  WebhookDiscoveredRawRssiEvent.new(beam,
                                    device_id,
                                    mac,
                                    map_id,
                                    org_id,
                                    rssi,
                                    site_id,
                                    ap_loc,
                                    ibeacon_major,
                                    ibeacon_minor,
                                    ibeacon_uuid,
                                    is_asset,
                                    mfg_company_id,
                                    mfg_data,
                                    service_packets,
                                    timestamp)
end

.namesObject

A mapping from model property names to API property names.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 77

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ap_loc'] = 'ap_loc'
  @_hash['beam'] = 'beam'
  @_hash['device_id'] = 'device_id'
  @_hash['ibeacon_major'] = 'ibeacon_major'
  @_hash['ibeacon_minor'] = 'ibeacon_minor'
  @_hash['ibeacon_uuid'] = 'ibeacon_uuid'
  @_hash['is_asset'] = 'is_asset'
  @_hash['mac'] = 'mac'
  @_hash['map_id'] = 'map_id'
  @_hash['mfg_company_id'] = 'mfg_company_id'
  @_hash['mfg_data'] = 'mfg_data'
  @_hash['org_id'] = 'org_id'
  @_hash['rssi'] = 'rssi'
  @_hash['service_packets'] = 'service_packets'
  @_hash['site_id'] = 'site_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



114
115
116
117
118
119
120
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 114

def self.nullables
  %w[
    ibeacon_major
    ibeacon_minor
    ibeacon_uuid
  ]
end

.optionalsObject

An array for optional fields



99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 99

def self.optionals
  %w[
    ap_loc
    ibeacon_major
    ibeacon_minor
    ibeacon_uuid
    is_asset
    mfg_company_id
    mfg_data
    service_packets
    timestamp
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 198

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.beam,
                            ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.device_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.mac,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.map_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.org_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.rssi,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.site_id,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['beam'],
                          ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['device_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['mac'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['map_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['org_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['rssi'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['site_id'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



250
251
252
253
254
255
256
257
258
259
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 250

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_loc: #{@ap_loc.inspect}, beam: #{@beam.inspect}, device_id:"\
  " #{@device_id.inspect}, ibeacon_major: #{@ibeacon_major.inspect}, ibeacon_minor:"\
  " #{@ibeacon_minor.inspect}, ibeacon_uuid: #{@ibeacon_uuid.inspect}, is_asset:"\
  " #{@is_asset.inspect}, mac: #{@mac.inspect}, map_id: #{@map_id.inspect}, mfg_company_id:"\
  " #{@mfg_company_id.inspect}, mfg_data: #{@mfg_data.inspect}, org_id: #{@org_id.inspect},"\
  " rssi: #{@rssi.inspect}, service_packets: #{@service_packets.inspect}, site_id:"\
  " #{@site_id.inspect}, timestamp: #{@timestamp.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



239
240
241
242
243
244
245
246
247
# File 'lib/mist_api/models/webhook_discovered_raw_rssi_event.rb', line 239

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_loc: #{@ap_loc}, beam: #{@beam}, device_id: #{@device_id},"\
  " ibeacon_major: #{@ibeacon_major}, ibeacon_minor: #{@ibeacon_minor}, ibeacon_uuid:"\
  " #{@ibeacon_uuid}, is_asset: #{@is_asset}, mac: #{@mac}, map_id: #{@map_id},"\
  " mfg_company_id: #{@mfg_company_id}, mfg_data: #{@mfg_data}, org_id: #{@org_id}, rssi:"\
  " #{@rssi}, service_packets: #{@service_packets}, site_id: #{@site_id}, timestamp:"\
  " #{@timestamp}>"
end