Sha256: d0aa8a00e3d0b3a1d0c0a045a840d16a36ffaf604eb82267514218e3542ce54b
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true module DjiMqttConnect module Thing::Product class EventsMessage < DjiMqttConnect::Message attribute :bid, Types::UUID attribute :tid, Types::UUID attribute :timestamp, Types::Timestamp # Can be determined from the topic, but included for convenience attribute? :gateway, Types::SerialNumber # NOTE: Included in most events messages, requires a reply on the events_reply topic if true attribute? :need_reply, Types::Integer.enum(0, 1) attribute :_data, Types::Hash attribute :_method, Types::String attribute :data, Types::Hash.default({}.freeze) def need_reply? need_reply == 1 end def humanized_summary Translations.thing_product_events_summary(_method, **humanized_summary_interpolation) end def humanized_summary_interpolation data.to_h.merge(method: _method, flight_ids: flight_ids.join(", ")) end # All the flight IDs in the message def flight_ids [] end def to_s # Include data method for Generic messages instance_of?(EventsMessage) ? "#{super}[#{_method}]" : super end end end end
Version data entries
5 entries across 5 versions & 1 rubygems