Class: MistApi::StatsAssetServicePacket
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- MistApi::StatsAssetServicePacket
- Defined in:
- lib/mist_api/models/stats_asset_service_packet.rb
Overview
Service data advertisement from a BLE asset
Instance Attribute Summary collapse
-
#data ⇒ String
Service data payload (hex encoded).
-
#last_rx_time ⇒ Integer
Unix timestamp when this service data was last received.
-
#rx_cnt ⇒ Integer
Total number of times this service data was received.
-
#uuid ⇒ String
Service UUID.
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(data = SKIP, last_rx_time = SKIP, rx_cnt = SKIP, uuid = SKIP) ⇒ StatsAssetServicePacket
constructor
A new instance of StatsAssetServicePacket.
-
#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(data = SKIP, last_rx_time = SKIP, rx_cnt = SKIP, uuid = SKIP) ⇒ StatsAssetServicePacket
Returns a new instance of StatsAssetServicePacket.
53 54 55 56 57 58 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 53 def initialize(data = SKIP, last_rx_time = SKIP, rx_cnt = SKIP, uuid = SKIP) @data = data unless data == SKIP @last_rx_time = last_rx_time unless last_rx_time == SKIP @rx_cnt = rx_cnt unless rx_cnt == SKIP @uuid = uuid unless uuid == SKIP end |
Instance Attribute Details
#data ⇒ String
Service data payload (hex encoded)
14 15 16 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 14 def data @data end |
#last_rx_time ⇒ Integer
Unix timestamp when this service data was last received
18 19 20 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 18 def last_rx_time @last_rx_time end |
#rx_cnt ⇒ Integer
Total number of times this service data was received
22 23 24 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 22 def rx_cnt @rx_cnt end |
#uuid ⇒ String
Service UUID
26 27 28 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 26 def uuid @uuid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 61 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. data = hash.key?('data') ? hash['data'] : SKIP last_rx_time = hash.key?('last_rx_time') ? hash['last_rx_time'] : SKIP rx_cnt = hash.key?('rx_cnt') ? hash['rx_cnt'] : SKIP uuid = hash.key?('uuid') ? hash['uuid'] : SKIP # Create object from extracted values. StatsAssetServicePacket.new(data, last_rx_time, rx_cnt, uuid) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['data'] = 'data' @_hash['last_rx_time'] = 'last_rx_time' @_hash['rx_cnt'] = 'rx_cnt' @_hash['uuid'] = 'uuid' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 39 def self.optionals %w[ data last_rx_time rx_cnt uuid ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
85 86 87 88 89 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 85 def inspect class_name = self.class.name.split('::').last "<#{class_name} data: #{@data.inspect}, last_rx_time: #{@last_rx_time.inspect}, rx_cnt:"\ " #{@rx_cnt.inspect}, uuid: #{@uuid.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
78 79 80 81 82 |
# File 'lib/mist_api/models/stats_asset_service_packet.rb', line 78 def to_s class_name = self.class.name.split('::').last "<#{class_name} data: #{@data}, last_rx_time: #{@last_rx_time}, rx_cnt: #{@rx_cnt}, uuid:"\ " #{@uuid}>" end |