Class: MistApi::StatsAsset
- Defined in:
- lib/mist_api/models/stats_asset.rb
Overview
Asset statistics
Instance Attribute Summary collapse
-
#battery_voltage ⇒ Float
Battery voltage, in mV.
-
#beam ⇒ Integer
Battery voltage, in mV.
-
#by ⇒ String
Source type.
-
#device_id ⇒ UUID | String
Device ID of the loudest AP.
-
#device_name ⇒ String
Device ID of the loudest AP.
-
#duration ⇒ Integer
Device ID of the loudest AP.
-
#eddystone_uid_instance ⇒ String
Device ID of the loudest AP.
-
#eddystone_uid_namespace ⇒ String
Device ID of the loudest AP.
-
#eddystone_url_url ⇒ String
Device ID of the loudest AP.
-
#ibeacon_major ⇒ Integer
Major number for iBeacon.
-
#ibeacon_minor ⇒ Integer
Minor number for iBeacon.
-
#ibeacon_uuid ⇒ UUID | String
Minor number for iBeacon.
-
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization.
-
#last_seen ⇒ Float
Last seen timestamp.
-
#mac ⇒ String
Bluetooth MAC.
-
#manufacture ⇒ String
Manufacturer name resolved from company ID.
-
#map_id ⇒ UUID | String
Map where the device belongs to.
-
#mfg_company_id ⇒ Integer
BLE manufacturer company ID from advertisement.
-
#mfg_data ⇒ String
Manufacturer-specific data (hex encoded).
-
#name ⇒ String
Name / label of the device.
-
#rssi ⇒ Integer
Signal strength (RSSI) of the loudest AP in dBm.
-
#rssizones ⇒ Array[AssetRssiZone]
Only send this for individual asset stat.
-
#service_packets ⇒ Array[StatsAssetServicePacket]
List of all service data advertisements (maximum length of 10).
-
#temperature ⇒ Float
List of all service data advertisements (maximum length of 10).
-
#ttl ⇒ Integer
Time-to-live in seconds; how long this asset data is valid in cache.
-
#x ⇒ Float
X in pixel.
-
#y ⇒ Float
Y in pixel.
-
#zones ⇒ Array[AssetZone]
Only send this for individual asset stat.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(mac = nil, ttl = SKIP, battery_voltage = SKIP, beam = SKIP, by = SKIP, device_id = SKIP, device_name = SKIP, duration = SKIP, eddystone_uid_instance = SKIP, eddystone_uid_namespace = SKIP, eddystone_url_url = SKIP, ibeacon_major = SKIP, ibeacon_minor = SKIP, ibeacon_uuid = SKIP, id = SKIP, last_seen = SKIP, manufacture = SKIP, map_id = SKIP, mfg_company_id = SKIP, mfg_data = SKIP, name = SKIP, rssi = SKIP, rssizones = SKIP, service_packets = SKIP, temperature = SKIP, x = SKIP, y = SKIP, zones = SKIP) ⇒ StatsAsset
constructor
A new instance of StatsAsset.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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 = nil, ttl = SKIP, battery_voltage = SKIP, beam = SKIP, by = SKIP, device_id = SKIP, device_name = SKIP, duration = SKIP, eddystone_uid_instance = SKIP, eddystone_uid_namespace = SKIP, eddystone_url_url = SKIP, ibeacon_major = SKIP, ibeacon_minor = SKIP, ibeacon_uuid = SKIP, id = SKIP, last_seen = SKIP, manufacture = SKIP, map_id = SKIP, mfg_company_id = SKIP, mfg_data = SKIP, name = SKIP, rssi = SKIP, rssizones = SKIP, service_packets = SKIP, temperature = SKIP, x = SKIP, y = SKIP, zones = SKIP) ⇒ StatsAsset
Returns a new instance of StatsAsset.
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 237 238 239 |
# File 'lib/mist_api/models/stats_asset.rb', line 201 def initialize(mac = nil, ttl = SKIP, battery_voltage = SKIP, beam = SKIP, by = SKIP, device_id = SKIP, device_name = SKIP, duration = SKIP, eddystone_uid_instance = SKIP, eddystone_uid_namespace = SKIP, eddystone_url_url = SKIP, ibeacon_major = SKIP, ibeacon_minor = SKIP, ibeacon_uuid = SKIP, id = SKIP, last_seen = SKIP, manufacture = SKIP, map_id = SKIP, mfg_company_id = SKIP, mfg_data = SKIP, name = SKIP, rssi = SKIP, rssizones = SKIP, service_packets = SKIP, temperature = SKIP, x = SKIP, y = SKIP, zones = SKIP) @ttl = ttl unless ttl == SKIP @battery_voltage = battery_voltage unless battery_voltage == SKIP @beam = beam unless beam == SKIP @by = by unless by == SKIP @device_id = device_id unless device_id == SKIP @device_name = device_name unless device_name == SKIP @duration = duration unless duration == 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 unless id == SKIP @last_seen = last_seen unless last_seen == SKIP @mac = mac @manufacture = manufacture unless manufacture == SKIP @map_id = map_id unless map_id == SKIP @mfg_company_id = mfg_company_id unless mfg_company_id == SKIP @mfg_data = mfg_data unless mfg_data == SKIP @name = name unless name == SKIP @rssi = rssi unless rssi == SKIP @rssizones = rssizones unless rssizones == SKIP @service_packets = service_packets unless service_packets == SKIP @temperature = temperature unless temperature == SKIP @x = x unless x == SKIP @y = y unless y == SKIP @zones = zones unless zones == SKIP end |
Instance Attribute Details
#battery_voltage ⇒ Float
Battery voltage, in mV
18 19 20 |
# File 'lib/mist_api/models/stats_asset.rb', line 18 def battery_voltage @battery_voltage end |
#beam ⇒ Integer
Battery voltage, in mV
22 23 24 |
# File 'lib/mist_api/models/stats_asset.rb', line 22 def beam @beam end |
#by ⇒ String
Source type
26 27 28 |
# File 'lib/mist_api/models/stats_asset.rb', line 26 def by @by end |
#device_id ⇒ UUID | String
Device ID of the loudest AP
30 31 32 |
# File 'lib/mist_api/models/stats_asset.rb', line 30 def device_id @device_id end |
#device_name ⇒ String
Device ID of the loudest AP
34 35 36 |
# File 'lib/mist_api/models/stats_asset.rb', line 34 def device_name @device_name end |
#duration ⇒ Integer
Device ID of the loudest AP
38 39 40 |
# File 'lib/mist_api/models/stats_asset.rb', line 38 def duration @duration end |
#eddystone_uid_instance ⇒ String
Device ID of the loudest AP
42 43 44 |
# File 'lib/mist_api/models/stats_asset.rb', line 42 def eddystone_uid_instance @eddystone_uid_instance end |
#eddystone_uid_namespace ⇒ String
Device ID of the loudest AP
46 47 48 |
# File 'lib/mist_api/models/stats_asset.rb', line 46 def eddystone_uid_namespace @eddystone_uid_namespace end |
#eddystone_url_url ⇒ String
Device ID of the loudest AP
50 51 52 |
# File 'lib/mist_api/models/stats_asset.rb', line 50 def eddystone_url_url @eddystone_url_url end |
#ibeacon_major ⇒ Integer
Major number for iBeacon
54 55 56 |
# File 'lib/mist_api/models/stats_asset.rb', line 54 def ibeacon_major @ibeacon_major end |
#ibeacon_minor ⇒ Integer
Minor number for iBeacon
58 59 60 |
# File 'lib/mist_api/models/stats_asset.rb', line 58 def ibeacon_minor @ibeacon_minor end |
#ibeacon_uuid ⇒ UUID | String
Minor number for iBeacon
62 63 64 |
# File 'lib/mist_api/models/stats_asset.rb', line 62 def ibeacon_uuid @ibeacon_uuid end |
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization
66 67 68 |
# File 'lib/mist_api/models/stats_asset.rb', line 66 def id @id end |
#last_seen ⇒ Float
Last seen timestamp
70 71 72 |
# File 'lib/mist_api/models/stats_asset.rb', line 70 def last_seen @last_seen end |
#mac ⇒ String
Bluetooth MAC
74 75 76 |
# File 'lib/mist_api/models/stats_asset.rb', line 74 def mac @mac end |
#manufacture ⇒ String
Manufacturer name resolved from company ID
78 79 80 |
# File 'lib/mist_api/models/stats_asset.rb', line 78 def manufacture @manufacture end |
#map_id ⇒ UUID | String
Map where the device belongs to
82 83 84 |
# File 'lib/mist_api/models/stats_asset.rb', line 82 def map_id @map_id end |
#mfg_company_id ⇒ Integer
BLE manufacturer company ID from advertisement
86 87 88 |
# File 'lib/mist_api/models/stats_asset.rb', line 86 def mfg_company_id @mfg_company_id end |
#mfg_data ⇒ String
Manufacturer-specific data (hex encoded)
90 91 92 |
# File 'lib/mist_api/models/stats_asset.rb', line 90 def mfg_data @mfg_data end |
#name ⇒ String
Name / label of the device
94 95 96 |
# File 'lib/mist_api/models/stats_asset.rb', line 94 def name @name end |
#rssi ⇒ Integer
Signal strength (RSSI) of the loudest AP in dBm
98 99 100 |
# File 'lib/mist_api/models/stats_asset.rb', line 98 def rssi @rssi end |
#rssizones ⇒ Array[AssetRssiZone]
Only send this for individual asset stat
102 103 104 |
# File 'lib/mist_api/models/stats_asset.rb', line 102 def rssizones @rssizones end |
#service_packets ⇒ Array[StatsAssetServicePacket]
List of all service data advertisements (maximum length of 10)
106 107 108 |
# File 'lib/mist_api/models/stats_asset.rb', line 106 def service_packets @service_packets end |
#temperature ⇒ Float
List of all service data advertisements (maximum length of 10)
110 111 112 |
# File 'lib/mist_api/models/stats_asset.rb', line 110 def temperature @temperature end |
#ttl ⇒ Integer
Time-to-live in seconds; how long this asset data is valid in cache
14 15 16 |
# File 'lib/mist_api/models/stats_asset.rb', line 14 def ttl @ttl end |
#x ⇒ Float
X in pixel
114 115 116 |
# File 'lib/mist_api/models/stats_asset.rb', line 114 def x @x end |
#y ⇒ Float
Y in pixel
118 119 120 |
# File 'lib/mist_api/models/stats_asset.rb', line 118 def y @y end |
#zones ⇒ Array[AssetZone]
Only send this for individual asset stat
122 123 124 |
# File 'lib/mist_api/models/stats_asset.rb', line 122 def zones @zones end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 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 |
# File 'lib/mist_api/models/stats_asset.rb', line 242 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mac = hash.key?('mac') ? hash['mac'] : nil ttl = hash.key?('_ttl') ? hash['_ttl'] : SKIP battery_voltage = hash.key?('battery_voltage') ? hash['battery_voltage'] : SKIP beam = hash.key?('beam') ? hash['beam'] : SKIP by = hash.key?('by') ? hash['by'] : SKIP device_id = hash.key?('device_id') ? hash['device_id'] : SKIP device_name = hash.key?('device_name') ? hash['device_name'] : SKIP duration = hash.key?('duration') ? hash['duration'] : 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 id = hash.key?('id') ? hash['id'] : SKIP last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP manufacture = hash.key?('manufacture') ? hash['manufacture'] : SKIP map_id = hash.key?('map_id') ? hash['map_id'] : 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 rssi = hash.key?('rssi') ? hash['rssi'] : SKIP # Parameter is an array, so we need to iterate through it rssizones = nil unless hash['rssizones'].nil? rssizones = [] hash['rssizones'].each do |structure| rssizones << (AssetRssiZone.from_hash(structure) if structure) end end rssizones = SKIP unless hash.key?('rssizones') # 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 << (StatsAssetServicePacket.from_hash(structure) if structure) end end service_packets = SKIP unless hash.key?('service_packets') temperature = hash.key?('temperature') ? hash['temperature'] : SKIP x = hash.key?('x') ? hash['x'] : SKIP y = hash.key?('y') ? hash['y'] : SKIP # Parameter is an array, so we need to iterate through it zones = nil unless hash['zones'].nil? zones = [] hash['zones'].each do |structure| zones << (AssetZone.from_hash(structure) if structure) end end zones = SKIP unless hash.key?('zones') # Create object from extracted values. StatsAsset.new(mac, ttl, battery_voltage, beam, by, device_id, device_name, duration, eddystone_uid_instance, eddystone_uid_namespace, eddystone_url_url, ibeacon_major, ibeacon_minor, ibeacon_uuid, id, last_seen, manufacture, map_id, mfg_company_id, mfg_data, name, rssi, rssizones, service_packets, temperature, x, y, zones) end |
.names ⇒ Object
A mapping from model property names to API property names.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/mist_api/models/stats_asset.rb', line 125 def self.names @_hash = {} if @_hash.nil? @_hash['ttl'] = '_ttl' @_hash['battery_voltage'] = 'battery_voltage' @_hash['beam'] = 'beam' @_hash['by'] = 'by' @_hash['device_id'] = 'device_id' @_hash['device_name'] = 'device_name' @_hash['duration'] = 'duration' @_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['last_seen'] = 'last_seen' @_hash['mac'] = 'mac' @_hash['manufacture'] = 'manufacture' @_hash['map_id'] = 'map_id' @_hash['mfg_company_id'] = 'mfg_company_id' @_hash['mfg_data'] = 'mfg_data' @_hash['name'] = 'name' @_hash['rssi'] = 'rssi' @_hash['rssizones'] = 'rssizones' @_hash['service_packets'] = 'service_packets' @_hash['temperature'] = 'temperature' @_hash['x'] = 'x' @_hash['y'] = 'y' @_hash['zones'] = 'zones' @_hash end |
.nullables ⇒ Object
An array for nullable fields
192 193 194 195 196 197 198 199 |
# File 'lib/mist_api/models/stats_asset.rb', line 192 def self.nullables %w[ ibeacon_major ibeacon_minor ibeacon_uuid last_seen ] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/mist_api/models/stats_asset.rb', line 159 def self.optionals %w[ ttl battery_voltage beam by device_id device_name duration eddystone_uid_instance eddystone_uid_namespace eddystone_url_url ibeacon_major ibeacon_minor ibeacon_uuid id last_seen manufacture map_id mfg_company_id mfg_data name rssi rssizones service_packets temperature x y zones ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/mist_api/models/stats_asset.rb', line 353 def inspect class_name = self.class.name.split('::').last "<#{class_name} ttl: #{@ttl.inspect}, battery_voltage: #{@battery_voltage.inspect}, beam:"\ " #{@beam.inspect}, by: #{@by.inspect}, device_id: #{@device_id.inspect}, device_name:"\ " #{@device_name.inspect}, duration: #{@duration.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}, last_seen:"\ " #{@last_seen.inspect}, mac: #{@mac.inspect}, manufacture: #{@manufacture.inspect}, map_id:"\ " #{@map_id.inspect}, mfg_company_id: #{@mfg_company_id.inspect}, mfg_data:"\ " #{@mfg_data.inspect}, name: #{@name.inspect}, rssi: #{@rssi.inspect}, rssizones:"\ " #{@rssizones.inspect}, service_packets: #{@service_packets.inspect}, temperature:"\ " #{@temperature.inspect}, x: #{@x.inspect}, y: #{@y.inspect}, zones: #{@zones.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/mist_api/models/stats_asset.rb', line 339 def to_s class_name = self.class.name.split('::').last "<#{class_name} ttl: #{@ttl}, battery_voltage: #{@battery_voltage}, beam: #{@beam}, by:"\ " #{@by}, device_id: #{@device_id}, device_name: #{@device_name}, duration: #{@duration},"\ " 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}, last_seen: #{@last_seen}, mac: #{@mac}, manufacture: #{@manufacture}, map_id:"\ " #{@map_id}, mfg_company_id: #{@mfg_company_id}, mfg_data: #{@mfg_data}, name: #{@name},"\ " rssi: #{@rssi}, rssizones: #{@rssizones}, service_packets: #{@service_packets},"\ " temperature: #{@temperature}, x: #{@x}, y: #{@y}, zones: #{@zones}>" end |