Class: MistApi::WebhookLocationEvent

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

Overview

WebhookLocationEvent 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(id = nil, map_id = nil, site_id = nil, timestamp = nil, type = nil, x = nil, y = nil, battery_voltage = SKIP, eddystone_uid_instance = SKIP, eddystone_uid_namespace = SKIP, eddystone_url_url = SKIP, ibeacon_major = SKIP, ibeacon_minor = SKIP, ibeacon_uuid = SKIP, mac = SKIP, mfg_company_id = SKIP, mfg_data = SKIP, name = SKIP, wifi_beacon_extended_info = SKIP) ⇒ WebhookLocationEvent

Returns a new instance of WebhookLocationEvent.



142
143
144
145
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
# File 'lib/mist_api/models/webhook_location_event.rb', line 142

def initialize(id = nil, map_id = nil, site_id = nil, timestamp = nil,
               type = nil, x = nil, y = nil, battery_voltage = SKIP,
               eddystone_uid_instance = SKIP,
               eddystone_uid_namespace = SKIP, eddystone_url_url = SKIP,
               ibeacon_major = SKIP, ibeacon_minor = SKIP,
               ibeacon_uuid = SKIP, mac = SKIP, mfg_company_id = SKIP,
               mfg_data = SKIP, name = SKIP,
               wifi_beacon_extended_info = SKIP)
  @battery_voltage = battery_voltage unless battery_voltage == SKIP
  @eddystone_uid_instance = eddystone_uid_instance unless eddystone_uid_instance == SKIP
  @eddystone_uid_namespace = eddystone_uid_namespace unless eddystone_uid_namespace == SKIP
  @eddystone_url_url = eddystone_url_url unless eddystone_url_url == SKIP
  @ibeacon_major = ibeacon_major unless ibeacon_major == SKIP
  @ibeacon_minor = ibeacon_minor unless ibeacon_minor == SKIP
  @ibeacon_uuid = ibeacon_uuid unless ibeacon_uuid == SKIP
  @id = id
  @mac = mac unless mac == SKIP
  @map_id = map_id
  @mfg_company_id = mfg_company_id unless mfg_company_id == SKIP
  @mfg_data = mfg_data unless mfg_data == SKIP
  @name = name unless name == SKIP
  @site_id = site_id
  @timestamp = timestamp
  @type = type
  unless wifi_beacon_extended_info == SKIP
    @wifi_beacon_extended_info =
      wifi_beacon_extended_info
  end
  @x = x
  @y = y
end

Instance Attribute Details

#battery_voltageInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def battery_voltage
  @battery_voltage
end

#eddystone_uid_instanceString

TODO: Write general description for this method

Returns:

  • (String)


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

def eddystone_uid_instance
  @eddystone_uid_instance
end

#eddystone_uid_namespaceString

TODO: Write general description for this method

Returns:

  • (String)


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

def eddystone_uid_namespace
  @eddystone_uid_namespace
end

#eddystone_url_urlString

TODO: Write general description for this method

Returns:

  • (String)


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

def eddystone_url_url
  @eddystone_url_url
end

#ibeacon_majorInteger

Major number for iBeacon

Returns:

  • (Integer)


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

def ibeacon_major
  @ibeacon_major
end

#ibeacon_minorInteger

Minor number for iBeacon

Returns:

  • (Integer)


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

def ibeacon_minor
  @ibeacon_minor
end

#ibeacon_uuidUUID | String

Minor number for iBeacon

Returns:

  • (UUID | String)


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

def ibeacon_uuid
  @ibeacon_uuid
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#macString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


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

def mac
  @mac
end

#map_idUUID | String

Map id

Returns:

  • (UUID | String)


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

def map_id
  @map_id
end

#mfg_company_idInteger

Optional, BLE manufacturing company ID

Returns:

  • (Integer)


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

def mfg_company_id
  @mfg_company_id
end

#mfg_dataString

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

Returns:

  • (String)


59
60
61
# File 'lib/mist_api/models/webhook_location_event.rb', line 59

def mfg_data
  @mfg_data
end

#nameString

Name of the client, may be empty

Returns:

  • (String)


63
64
65
# File 'lib/mist_api/models/webhook_location_event.rb', line 63

def name
  @name
end

#site_idUUID | String

Name of the client, may be empty

Returns:

  • (UUID | String)


67
68
69
# File 'lib/mist_api/models/webhook_location_event.rb', line 67

def site_id
  @site_id
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


71
72
73
# File 'lib/mist_api/models/webhook_location_event.rb', line 71

def timestamp
  @timestamp
end

#typeString

Epoch (seconds)

Returns:

  • (String)


75
76
77
# File 'lib/mist_api/models/webhook_location_event.rb', line 75

def type
  @type
end

#wifi_beacon_extended_infoArray[WifiBeaconExtendedInfoItems]

Optional, list of extended beacon info packets heard from the client, frame and sequence control included with the payload

Returns:



80
81
82
# File 'lib/mist_api/models/webhook_location_event.rb', line 80

def wifi_beacon_extended_info
  @wifi_beacon_extended_info
end

#xFloat

x, in meter

Returns:

  • (Float)


84
85
86
# File 'lib/mist_api/models/webhook_location_event.rb', line 84

def x
  @x
end

#yFloat

y, in meter

Returns:

  • (Float)


88
89
90
# File 'lib/mist_api/models/webhook_location_event.rb', line 88

def y
  @y
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
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
# File 'lib/mist_api/models/webhook_location_event.rb', line 175

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  map_id = hash.key?('map_id') ? hash['map_id'] : nil
  site_id = hash.key?('site_id') ? hash['site_id'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  x = hash.key?('x') ? hash['x'] : nil
  y = hash.key?('y') ? hash['y'] : nil
  battery_voltage =
    hash.key?('battery_voltage') ? hash['battery_voltage'] : SKIP
  eddystone_uid_instance =
    hash.key?('eddystone_uid_instance') ? hash['eddystone_uid_instance'] : SKIP
  eddystone_uid_namespace =
    hash.key?('eddystone_uid_namespace') ? hash['eddystone_uid_namespace'] : SKIP
  eddystone_url_url =
    hash.key?('eddystone_url_url') ? hash['eddystone_url_url'] : 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
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  mfg_company_id =
    hash.key?('mfg_company_id') ? hash['mfg_company_id'] : SKIP
  mfg_data = hash.key?('mfg_data') ? hash['mfg_data'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  # Parameter is an array, so we need to iterate through it
  wifi_beacon_extended_info = nil
  unless hash['wifi_beacon_extended_info'].nil?
    wifi_beacon_extended_info = []
    hash['wifi_beacon_extended_info'].each do |structure|
      wifi_beacon_extended_info << (WifiBeaconExtendedInfoItems.from_hash(structure) if structure)
    end
  end

  wifi_beacon_extended_info = SKIP unless hash.key?('wifi_beacon_extended_info')

  # Create object from extracted values.
  WebhookLocationEvent.new(id,
                           map_id,
                           site_id,
                           timestamp,
                           type,
                           x,
                           y,
                           battery_voltage,
                           eddystone_uid_instance,
                           eddystone_uid_namespace,
                           eddystone_url_url,
                           ibeacon_major,
                           ibeacon_minor,
                           ibeacon_uuid,
                           mac,
                           mfg_company_id,
                           mfg_data,
                           name,
                           wifi_beacon_extended_info)
end

.namesObject

A mapping from model property names to API property names.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/mist_api/models/webhook_location_event.rb', line 91

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['battery_voltage'] = 'battery_voltage'
  @_hash['eddystone_uid_instance'] = 'eddystone_uid_instance'
  @_hash['eddystone_uid_namespace'] = 'eddystone_uid_namespace'
  @_hash['eddystone_url_url'] = 'eddystone_url_url'
  @_hash['ibeacon_major'] = 'ibeacon_major'
  @_hash['ibeacon_minor'] = 'ibeacon_minor'
  @_hash['ibeacon_uuid'] = 'ibeacon_uuid'
  @_hash['id'] = 'id'
  @_hash['mac'] = 'mac'
  @_hash['map_id'] = 'map_id'
  @_hash['mfg_company_id'] = 'mfg_company_id'
  @_hash['mfg_data'] = 'mfg_data'
  @_hash['name'] = 'name'
  @_hash['site_id'] = 'site_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash['type'] = 'type'
  @_hash['wifi_beacon_extended_info'] = 'wifi_beacon_extended_info'
  @_hash['x'] = 'x'
  @_hash['y'] = 'y'
  @_hash
end

.nullablesObject

An array for nullable fields



134
135
136
137
138
139
140
# File 'lib/mist_api/models/webhook_location_event.rb', line 134

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

.optionalsObject

An array for optional fields



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/mist_api/models/webhook_location_event.rb', line 116

def self.optionals
  %w[
    battery_voltage
    eddystone_uid_instance
    eddystone_uid_namespace
    eddystone_url_url
    ibeacon_major
    ibeacon_minor
    ibeacon_uuid
    mac
    mfg_company_id
    mfg_data
    name
    wifi_beacon_extended_info
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/mist_api/models/webhook_location_event.rb', line 237

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.id,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.map_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.site_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.timestamp,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.x,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.y,
                              ->(val) { val.instance_of? Float })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['id'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['map_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['site_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['timestamp'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['x'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['y'],
                            ->(val) { val.instance_of? Float })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/mist_api/models/webhook_location_event.rb', line 290

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} battery_voltage: #{@battery_voltage.inspect}, eddystone_uid_instance:"\
  " #{@eddystone_uid_instance.inspect}, eddystone_uid_namespace:"\
  " #{@eddystone_uid_namespace.inspect}, eddystone_url_url: #{@eddystone_url_url.inspect},"\
  " ibeacon_major: #{@ibeacon_major.inspect}, ibeacon_minor: #{@ibeacon_minor.inspect},"\
  " ibeacon_uuid: #{@ibeacon_uuid.inspect}, id: #{@id.inspect}, mac: #{@mac.inspect}, map_id:"\
  " #{@map_id.inspect}, mfg_company_id: #{@mfg_company_id.inspect}, mfg_data:"\
  " #{@mfg_data.inspect}, name: #{@name.inspect}, site_id: #{@site_id.inspect}, timestamp:"\
  " #{@timestamp.inspect}, type: #{@type.inspect}, wifi_beacon_extended_info:"\
  " #{@wifi_beacon_extended_info.inspect}, x: #{@x.inspect}, y: #{@y.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



278
279
280
281
282
283
284
285
286
287
# File 'lib/mist_api/models/webhook_location_event.rb', line 278

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} battery_voltage: #{@battery_voltage}, eddystone_uid_instance:"\
  " #{@eddystone_uid_instance}, eddystone_uid_namespace: #{@eddystone_uid_namespace},"\
  " eddystone_url_url: #{@eddystone_url_url}, ibeacon_major: #{@ibeacon_major}, ibeacon_minor:"\
  " #{@ibeacon_minor}, ibeacon_uuid: #{@ibeacon_uuid}, id: #{@id}, mac: #{@mac}, map_id:"\
  " #{@map_id}, mfg_company_id: #{@mfg_company_id}, mfg_data: #{@mfg_data}, name: #{@name},"\
  " site_id: #{@site_id}, timestamp: #{@timestamp}, type: #{@type}, wifi_beacon_extended_info:"\
  " #{@wifi_beacon_extended_info}, x: #{@x}, y: #{@y}>"
end