Class: MistApi::StatsBeacon
- Defined in:
- lib/mist_api/models/stats_beacon.rb
Overview
StatsBeacon Model.
Instance Attribute Summary collapse
-
#battery_voltage ⇒ Float
Battery voltage, in mV.
-
#eddystone_instance ⇒ String
Battery voltage, in mV.
-
#eddystone_namespace ⇒ String
Battery voltage, in mV.
-
#last_seen ⇒ Float
Last seen timestamp.
-
#mac ⇒ String
Last seen timestamp.
-
#map_id ⇒ UUID | String
Last seen timestamp.
-
#name ⇒ String
Last seen timestamp.
-
#power ⇒ Integer
Last seen timestamp.
-
#type ⇒ String
Last seen timestamp.
-
#x ⇒ Float
Last seen timestamp.
-
#y ⇒ Float
Last seen timestamp.
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, map_id = nil, name = nil, power = nil, type = nil, x = nil, y = nil, battery_voltage = SKIP, eddystone_instance = SKIP, eddystone_namespace = SKIP, last_seen = SKIP) ⇒ StatsBeacon
constructor
A new instance of StatsBeacon.
-
#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, map_id = nil, name = nil, power = nil, type = nil, x = nil, y = nil, battery_voltage = SKIP, eddystone_instance = SKIP, eddystone_namespace = SKIP, last_seen = SKIP) ⇒ StatsBeacon
Returns a new instance of StatsBeacon.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/mist_api/models/stats_beacon.rb', line 90 def initialize(mac = nil, map_id = nil, name = nil, power = nil, type = nil, x = nil, y = nil, battery_voltage = SKIP, eddystone_instance = SKIP, eddystone_namespace = SKIP, last_seen = SKIP) @battery_voltage = battery_voltage unless battery_voltage == SKIP @eddystone_instance = eddystone_instance unless eddystone_instance == SKIP @eddystone_namespace = eddystone_namespace unless eddystone_namespace == SKIP @last_seen = last_seen unless last_seen == SKIP @mac = mac @map_id = map_id @name = name @power = power @type = type @x = x @y = y end |
Instance Attribute Details
#battery_voltage ⇒ Float
Battery voltage, in mV
14 15 16 |
# File 'lib/mist_api/models/stats_beacon.rb', line 14 def battery_voltage @battery_voltage end |
#eddystone_instance ⇒ String
Battery voltage, in mV
18 19 20 |
# File 'lib/mist_api/models/stats_beacon.rb', line 18 def eddystone_instance @eddystone_instance end |
#eddystone_namespace ⇒ String
Battery voltage, in mV
22 23 24 |
# File 'lib/mist_api/models/stats_beacon.rb', line 22 def eddystone_namespace @eddystone_namespace end |
#last_seen ⇒ Float
Last seen timestamp
26 27 28 |
# File 'lib/mist_api/models/stats_beacon.rb', line 26 def last_seen @last_seen end |
#mac ⇒ String
Last seen timestamp
30 31 32 |
# File 'lib/mist_api/models/stats_beacon.rb', line 30 def mac @mac end |
#map_id ⇒ UUID | String
Last seen timestamp
34 35 36 |
# File 'lib/mist_api/models/stats_beacon.rb', line 34 def map_id @map_id end |
#name ⇒ String
Last seen timestamp
38 39 40 |
# File 'lib/mist_api/models/stats_beacon.rb', line 38 def name @name end |
#power ⇒ Integer
Last seen timestamp
42 43 44 |
# File 'lib/mist_api/models/stats_beacon.rb', line 42 def power @power end |
#type ⇒ String
Last seen timestamp
46 47 48 |
# File 'lib/mist_api/models/stats_beacon.rb', line 46 def type @type end |
#x ⇒ Float
Last seen timestamp
50 51 52 |
# File 'lib/mist_api/models/stats_beacon.rb', line 50 def x @x end |
#y ⇒ Float
Last seen timestamp
54 55 56 |
# File 'lib/mist_api/models/stats_beacon.rb', line 54 def y @y end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/mist_api/models/stats_beacon.rb', line 108 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mac = hash.key?('mac') ? hash['mac'] : nil map_id = hash.key?('map_id') ? hash['map_id'] : nil name = hash.key?('name') ? hash['name'] : nil power = hash.key?('power') ? hash['power'] : 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_instance = hash.key?('eddystone_instance') ? hash['eddystone_instance'] : SKIP eddystone_namespace = hash.key?('eddystone_namespace') ? hash['eddystone_namespace'] : SKIP last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP # Create object from extracted values. StatsBeacon.new(mac, map_id, name, power, type, x, y, battery_voltage, eddystone_instance, eddystone_namespace, last_seen) end |
.names ⇒ Object
A mapping from model property names to API property names.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/mist_api/models/stats_beacon.rb', line 57 def self.names @_hash = {} if @_hash.nil? @_hash['battery_voltage'] = 'battery_voltage' @_hash['eddystone_instance'] = 'eddystone_instance' @_hash['eddystone_namespace'] = 'eddystone_namespace' @_hash['last_seen'] = 'last_seen' @_hash['mac'] = 'mac' @_hash['map_id'] = 'map_id' @_hash['name'] = 'name' @_hash['power'] = 'power' @_hash['type'] = 'type' @_hash['x'] = 'x' @_hash['y'] = 'y' @_hash end |
.nullables ⇒ Object
An array for nullable fields
84 85 86 87 88 |
# File 'lib/mist_api/models/stats_beacon.rb', line 84 def self.nullables %w[ last_seen ] end |
.optionals ⇒ Object
An array for optional fields
74 75 76 77 78 79 80 81 |
# File 'lib/mist_api/models/stats_beacon.rb', line 74 def self.optionals %w[ battery_voltage eddystone_instance eddystone_namespace last_seen ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
151 152 153 154 155 156 157 158 |
# File 'lib/mist_api/models/stats_beacon.rb', line 151 def inspect class_name = self.class.name.split('::').last "<#{class_name} battery_voltage: #{@battery_voltage.inspect}, eddystone_instance:"\ " #{@eddystone_instance.inspect}, eddystone_namespace: #{@eddystone_namespace.inspect},"\ " last_seen: #{@last_seen.inspect}, mac: #{@mac.inspect}, map_id: #{@map_id.inspect}, name:"\ " #{@name.inspect}, power: #{@power.inspect}, type: #{@type.inspect}, x: #{@x.inspect}, y:"\ " #{@y.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
142 143 144 145 146 147 148 |
# File 'lib/mist_api/models/stats_beacon.rb', line 142 def to_s class_name = self.class.name.split('::').last "<#{class_name} battery_voltage: #{@battery_voltage}, eddystone_instance:"\ " #{@eddystone_instance}, eddystone_namespace: #{@eddystone_namespace}, last_seen:"\ " #{@last_seen}, mac: #{@mac}, map_id: #{@map_id}, name: #{@name}, power: #{@power}, type:"\ " #{@type}, x: #{@x}, y: #{@y}>" end |