Class: MistApi::Map

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

Overview

Map

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(created_time = SKIP, flags = SKIP, for_site = SKIP, geofences = SKIP, group_idx = SKIP, group_name = SKIP, height = SKIP, height_m = SKIP, id = SKIP, latlng_br = SKIP, latlng_tl = SKIP, locked = false, modified_time = SKIP, name = SKIP, occupancy_limit = SKIP, org_id = SKIP, orientation = 0, origin_x = SKIP, origin_y = SKIP, ppm = SKIP, site_id = SKIP, sitesurvey_path = SKIP, thumbnail_url = SKIP, type = MapTypeEnum::IMAGE, url = SKIP, view = SKIP, wall_path = SKIP, wayfinding = SKIP, wayfinding_path = SKIP, width = SKIP, width_m = SKIP, additional_properties = nil) ⇒ Map

Returns a new instance of Map.



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
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
# File 'lib/mist_api/models/map.rb', line 217

def initialize(created_time = SKIP, flags = SKIP, for_site = SKIP,
               geofences = SKIP, group_idx = SKIP, group_name = SKIP,
               height = SKIP, height_m = SKIP, id = SKIP, latlng_br = SKIP,
               latlng_tl = SKIP, locked = false, modified_time = SKIP,
               name = SKIP, occupancy_limit = SKIP, org_id = SKIP,
               orientation = 0, origin_x = SKIP, origin_y = SKIP,
               ppm = SKIP, site_id = SKIP, sitesurvey_path = SKIP,
               thumbnail_url = SKIP, type = MapTypeEnum::IMAGE, url = SKIP,
               view = SKIP, wall_path = SKIP, wayfinding = SKIP,
               wayfinding_path = SKIP, width = SKIP, width_m = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @created_time = created_time unless created_time == SKIP
  @flags = flags unless flags == SKIP
  @for_site = for_site unless for_site == SKIP
  @geofences = geofences unless geofences == SKIP
  @group_idx = group_idx unless group_idx == SKIP
  @group_name = group_name unless group_name == SKIP
  @height = height unless height == SKIP
  @height_m = height_m unless height_m == SKIP
  @id = id unless id == SKIP
  @latlng_br = latlng_br unless latlng_br == SKIP
  @latlng_tl = latlng_tl unless latlng_tl == SKIP
  @locked = locked unless locked == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name unless name == SKIP
  @occupancy_limit = occupancy_limit unless occupancy_limit == SKIP
  @org_id = org_id unless org_id == SKIP
  @orientation = orientation unless orientation == SKIP
  @origin_x = origin_x unless origin_x == SKIP
  @origin_y = origin_y unless origin_y == SKIP
  @ppm = ppm unless ppm == SKIP
  @site_id = site_id unless site_id == SKIP
  @sitesurvey_path = sitesurvey_path unless sitesurvey_path == SKIP
  @thumbnail_url = thumbnail_url unless thumbnail_url == SKIP
  @type = type unless type == SKIP
  @url = url unless url == SKIP
  @view = view unless view == SKIP
  @wall_path = wall_path unless wall_path == SKIP
  @wayfinding = wayfinding unless wayfinding == SKIP
  @wayfinding_path = wayfinding_path unless wayfinding_path == SKIP
  @width = width unless width == SKIP
  @width_m = width_m unless width_m == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


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

def created_time
  @created_time
end

#flagsHash[String, Integer]

Name/val pair objects for location engine to use

Returns:

  • (Hash[String, Integer])


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

def flags
  @flags
end

#for_siteTrueClass | FalseClass

Name/val pair objects for location engine to use

Returns:

  • (TrueClass | FalseClass)


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

def for_site
  @for_site
end

#geofencesArray[MapGeofence]

List of geofences for the map

Returns:



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

def geofences
  @geofences
end

#group_idxInteger

maps grouping, typically used for floor, optional

Returns:

  • (Integer)


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

def group_idx
  @group_idx
end

#group_nameString

maps grouping, optional

Returns:

  • (String)


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

def group_name
  @group_name
end

#heightInteger

When type=image, height of the image map

Returns:

  • (Integer)


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

def height
  @height
end

#height_mFloat

When type=image, height of the image map

Returns:

  • (Float)


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

def height_m
  @height_m
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#latlng_brLatlngBr

When type=google, latitude / longitude of the bottom-right corner

Returns:



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

def latlng_br
  @latlng_br
end

#latlng_tlLatlngTl

When type=google, latitude / longitude of the top-left corner

Returns:



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

def latlng_tl
  @latlng_tl
end

#lockedTrueClass | FalseClass

Whether this map is considered locked down

Returns:

  • (TrueClass | FalseClass)


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

def locked
  @locked
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


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

def modified_time
  @modified_time
end

#nameString

The name of the map

Returns:

  • (String)


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

def name
  @name
end

#occupancy_limitInteger

The name of the map

Returns:

  • (Integer)


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

def occupancy_limit
  @occupancy_limit
end

#org_idUUID | String

The name of the map

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#orientationInteger

Orientation of the map, 0 means up is north, 90 means up is west

Returns:

  • (Integer)


78
79
80
# File 'lib/mist_api/models/map.rb', line 78

def orientation
  @orientation
end

#origin_xInteger

User-annotated X origin, pixels

Returns:

  • (Integer)


82
83
84
# File 'lib/mist_api/models/map.rb', line 82

def origin_x
  @origin_x
end

#origin_yInteger

User-annotated Y origin, pixels

Returns:

  • (Integer)


86
87
88
# File 'lib/mist_api/models/map.rb', line 86

def origin_y
  @origin_y
end

#ppmFloat

When type=image, pixels per meter

Returns:

  • (Float)


90
91
92
# File 'lib/mist_api/models/map.rb', line 90

def ppm
  @ppm
end

#site_idUUID | String

When type=image, pixels per meter

Returns:

  • (UUID | String)


94
95
96
# File 'lib/mist_api/models/map.rb', line 94

def site_id
  @site_id
end

#sitesurvey_pathArray[MapSitesurveyPathItems]

Sitesurvey_path

Returns:



98
99
100
# File 'lib/mist_api/models/map.rb', line 98

def sitesurvey_path
  @sitesurvey_path
end

#thumbnail_urlString

When type=image, the url for the thumbnail image / preview

Returns:

  • (String)


102
103
104
# File 'lib/mist_api/models/map.rb', line 102

def thumbnail_url
  @thumbnail_url
end

#typeMapTypeEnum

enum: ‘google`, `image`

Returns:



106
107
108
# File 'lib/mist_api/models/map.rb', line 106

def type
  @type
end

#urlString

When type=image, the url

Returns:

  • (String)


110
111
112
# File 'lib/mist_api/models/map.rb', line 110

def url
  @url
end

#viewMapViewEnum

if ‘type`==`google`. enum: `hybrid`, `roadmap`, `satellite`, `terrain`

Returns:



114
115
116
# File 'lib/mist_api/models/map.rb', line 114

def view
  @view
end

#wall_pathMapWallPath

JSON blob for wall definition (same format as wayfinding_path)

Returns:



118
119
120
# File 'lib/mist_api/models/map.rb', line 118

def wall_path
  @wall_path
end

#wayfindingMapWayfinding

Properties related to wayfinding

Returns:



122
123
124
# File 'lib/mist_api/models/map.rb', line 122

def wayfinding
  @wayfinding
end

#wayfinding_pathMapWayfindingPath

JSON blob for wayfinding (using Dijkstra’s algorithm)

Returns:



126
127
128
# File 'lib/mist_api/models/map.rb', line 126

def wayfinding_path
  @wayfinding_path
end

#widthInteger

When type=image, width of the image map

Returns:

  • (Integer)


130
131
132
# File 'lib/mist_api/models/map.rb', line 130

def width
  @width
end

#width_mFloat

When type=image, width of the image map

Returns:

  • (Float)


134
135
136
# File 'lib/mist_api/models/map.rb', line 134

def width_m
  @width_m
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/mist_api/models/map.rb', line 266

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  flags = hash.key?('flags') ? hash['flags'] : SKIP
  for_site = hash.key?('for_site') ? hash['for_site'] : SKIP
  # Parameter is an array, so we need to iterate through it
  geofences = nil
  unless hash['geofences'].nil?
    geofences = []
    hash['geofences'].each do |structure|
      geofences << (MapGeofence.from_hash(structure) if structure)
    end
  end

  geofences = SKIP unless hash.key?('geofences')
  group_idx = hash.key?('group_idx') ? hash['group_idx'] : SKIP
  group_name = hash.key?('group_name') ? hash['group_name'] : SKIP
  height = hash.key?('height') ? hash['height'] : SKIP
  height_m = hash.key?('height_m') ? hash['height_m'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  latlng_br = LatlngBr.from_hash(hash['latlng_br']) if hash['latlng_br']
  latlng_tl = LatlngTl.from_hash(hash['latlng_tl']) if hash['latlng_tl']
  locked = hash['locked'] ||= false
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  occupancy_limit =
    hash.key?('occupancy_limit') ? hash['occupancy_limit'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  orientation = hash['orientation'] ||= 0
  origin_x = hash.key?('origin_x') ? hash['origin_x'] : SKIP
  origin_y = hash.key?('origin_y') ? hash['origin_y'] : SKIP
  ppm = hash.key?('ppm') ? hash['ppm'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  # Parameter is an array, so we need to iterate through it
  sitesurvey_path = nil
  unless hash['sitesurvey_path'].nil?
    sitesurvey_path = []
    hash['sitesurvey_path'].each do |structure|
      sitesurvey_path << (MapSitesurveyPathItems.from_hash(structure) if structure)
    end
  end

  sitesurvey_path = SKIP unless hash.key?('sitesurvey_path')
  thumbnail_url = hash.key?('thumbnail_url') ? hash['thumbnail_url'] : SKIP
  type = hash['type'] ||= MapTypeEnum::IMAGE
  url = hash.key?('url') ? hash['url'] : SKIP
  view = hash.key?('view') ? hash['view'] : SKIP
  wall_path = MapWallPath.from_hash(hash['wall_path']) if hash['wall_path']
  wayfinding = MapWayfinding.from_hash(hash['wayfinding']) if hash['wayfinding']
  wayfinding_path = MapWayfindingPath.from_hash(hash['wayfinding_path']) if
    hash['wayfinding_path']
  width = hash.key?('width') ? hash['width'] : SKIP
  width_m = hash.key?('width_m') ? hash['width_m'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Map.new(created_time,
          flags,
          for_site,
          geofences,
          group_idx,
          group_name,
          height,
          height_m,
          id,
          latlng_br,
          latlng_tl,
          locked,
          modified_time,
          name,
          occupancy_limit,
          org_id,
          orientation,
          origin_x,
          origin_y,
          ppm,
          site_id,
          sitesurvey_path,
          thumbnail_url,
          type,
          url,
          view,
          wall_path,
          wayfinding,
          wayfinding_path,
          width,
          width_m,
          additional_properties)
end

.namesObject

A mapping from model property names to API property names.



137
138
139
140
141
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
# File 'lib/mist_api/models/map.rb', line 137

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_time'] = 'created_time'
  @_hash['flags'] = 'flags'
  @_hash['for_site'] = 'for_site'
  @_hash['geofences'] = 'geofences'
  @_hash['group_idx'] = 'group_idx'
  @_hash['group_name'] = 'group_name'
  @_hash['height'] = 'height'
  @_hash['height_m'] = 'height_m'
  @_hash['id'] = 'id'
  @_hash['latlng_br'] = 'latlng_br'
  @_hash['latlng_tl'] = 'latlng_tl'
  @_hash['locked'] = 'locked'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['occupancy_limit'] = 'occupancy_limit'
  @_hash['org_id'] = 'org_id'
  @_hash['orientation'] = 'orientation'
  @_hash['origin_x'] = 'origin_x'
  @_hash['origin_y'] = 'origin_y'
  @_hash['ppm'] = 'ppm'
  @_hash['site_id'] = 'site_id'
  @_hash['sitesurvey_path'] = 'sitesurvey_path'
  @_hash['thumbnail_url'] = 'thumbnail_url'
  @_hash['type'] = 'type'
  @_hash['url'] = 'url'
  @_hash['view'] = 'view'
  @_hash['wall_path'] = 'wall_path'
  @_hash['wayfinding'] = 'wayfinding'
  @_hash['wayfinding_path'] = 'wayfinding_path'
  @_hash['width'] = 'width'
  @_hash['width_m'] = 'width_m'
  @_hash
end

.nullablesObject

An array for nullable fields



211
212
213
214
215
# File 'lib/mist_api/models/map.rb', line 211

def self.nullables
  %w[
    view
  ]
end

.optionalsObject

An array for optional fields



174
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
# File 'lib/mist_api/models/map.rb', line 174

def self.optionals
  %w[
    created_time
    flags
    for_site
    geofences
    group_idx
    group_name
    height
    height_m
    id
    latlng_br
    latlng_tl
    locked
    modified_time
    name
    occupancy_limit
    org_id
    orientation
    origin_x
    origin_y
    ppm
    site_id
    sitesurvey_path
    thumbnail_url
    type
    url
    view
    wall_path
    wayfinding
    wayfinding_path
    width
    width_m
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/mist_api/models/map.rb', line 380

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time.inspect}, flags: #{@flags.inspect}, for_site:"\
  " #{@for_site.inspect}, geofences: #{@geofences.inspect}, group_idx: #{@group_idx.inspect},"\
  " group_name: #{@group_name.inspect}, height: #{@height.inspect}, height_m:"\
  " #{@height_m.inspect}, id: #{@id.inspect}, latlng_br: #{@latlng_br.inspect}, latlng_tl:"\
  " #{@latlng_tl.inspect}, locked: #{@locked.inspect}, modified_time:"\
  " #{@modified_time.inspect}, name: #{@name.inspect}, occupancy_limit:"\
  " #{@occupancy_limit.inspect}, org_id: #{@org_id.inspect}, orientation:"\
  " #{@orientation.inspect}, origin_x: #{@origin_x.inspect}, origin_y: #{@origin_y.inspect},"\
  " ppm: #{@ppm.inspect}, site_id: #{@site_id.inspect}, sitesurvey_path:"\
  " #{@sitesurvey_path.inspect}, thumbnail_url: #{@thumbnail_url.inspect}, type:"\
  " #{@type.inspect}, url: #{@url.inspect}, view: #{@view.inspect}, wall_path:"\
  " #{@wall_path.inspect}, wayfinding: #{@wayfinding.inspect}, wayfinding_path:"\
  " #{@wayfinding_path.inspect}, width: #{@width.inspect}, width_m: #{@width_m.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/mist_api/models/map.rb', line 365

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time}, flags: #{@flags}, for_site: #{@for_site},"\
  " geofences: #{@geofences}, group_idx: #{@group_idx}, group_name: #{@group_name}, height:"\
  " #{@height}, height_m: #{@height_m}, id: #{@id}, latlng_br: #{@latlng_br}, latlng_tl:"\
  " #{@latlng_tl}, locked: #{@locked}, modified_time: #{@modified_time}, name: #{@name},"\
  " occupancy_limit: #{@occupancy_limit}, org_id: #{@org_id}, orientation: #{@orientation},"\
  " origin_x: #{@origin_x}, origin_y: #{@origin_y}, ppm: #{@ppm}, site_id: #{@site_id},"\
  " sitesurvey_path: #{@sitesurvey_path}, thumbnail_url: #{@thumbnail_url}, type: #{@type},"\
  " url: #{@url}, view: #{@view}, wall_path: #{@wall_path}, wayfinding: #{@wayfinding},"\
  " wayfinding_path: #{@wayfinding_path}, width: #{@width}, width_m: #{@width_m},"\
  " additional_properties: #{@additional_properties}>"
end