Class: MistApi::WebhookLocationClientEvent

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

Overview

WebhookLocationClientEvent 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(mac = SKIP, map_id = SKIP, site_id = SKIP, timestamp = SKIP, type = 'wifi', wifi_beacon_extended_info = SKIP, x = SKIP, y = SKIP) ⇒ WebhookLocationClientEvent

Returns a new instance of WebhookLocationClientEvent.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 78

def initialize(mac = SKIP, map_id = SKIP, site_id = SKIP, timestamp = SKIP,
               type = 'wifi', wifi_beacon_extended_info = SKIP, x = SKIP,
               y = SKIP)
  @mac = mac unless mac == SKIP
  @map_id = map_id unless map_id == SKIP
  @site_id = site_id unless site_id == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @type = type unless type == SKIP
  unless wifi_beacon_extended_info == SKIP
    @wifi_beacon_extended_info =
      wifi_beacon_extended_info
  end
  @x = x unless x == SKIP
  @y = y unless y == SKIP
end

Instance Attribute Details

#macString

TODO: Write general description for this method

Returns:

  • (String)


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

def mac
  @mac
end

#map_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def map_id
  @map_id
end

#site_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


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

def timestamp
  @timestamp
end

#typeString

Epoch (seconds)

Returns:

  • (String)


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

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:



35
36
37
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 35

def wifi_beacon_extended_info
  @wifi_beacon_extended_info
end

#xFloat

x, in meter

Returns:

  • (Float)


39
40
41
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 39

def x
  @x
end

#yFloat

y, in meter

Returns:

  • (Float)


43
44
45
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 43

def y
  @y
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  map_id = hash.key?('map_id') ? hash['map_id'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  type = hash['type'] ||= 'wifi'
  # 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')
  x = hash.key?('x') ? hash['x'] : SKIP
  y = hash.key?('y') ? hash['y'] : SKIP

  # Create object from extracted values.
  WebhookLocationClientEvent.new(mac,
                                 map_id,
                                 site_id,
                                 timestamp,
                                 type,
                                 wifi_beacon_extended_info,
                                 x,
                                 y)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mac'] = 'mac'
  @_hash['map_id'] = 'map_id'
  @_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



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 60

def self.optionals
  %w[
    mac
    map_id
    site_id
    timestamp
    type
    wifi_beacon_extended_info
    x
    y
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



130
131
132
133
134
135
136
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 130

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



147
148
149
150
151
152
153
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 147

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} mac: #{@mac.inspect}, map_id: #{@map_id.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.



139
140
141
142
143
144
# File 'lib/mist_api/models/webhook_location_client_event.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} mac: #{@mac}, map_id: #{@map_id}, site_id: #{@site_id}, timestamp:"\
  " #{@timestamp}, type: #{@type}, wifi_beacon_extended_info: #{@wifi_beacon_extended_info},"\
  " x: #{@x}, y: #{@y}>"
end