Class: DjiMqttConnect::Thing::Product::StateReplyMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/dji_mqtt_connect/messages/thing/product/state_reply_message.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

current_timestamp, generate_bid, generate_tid, #to_s

Class Method Details

.build_for(events_message, result: 0) ⇒ Object

a result of 0 means we approve of this action



7
8
9
10
11
12
13
14
15
16
# File 'lib/dji_mqtt_connect/messages/thing/product/state_reply_message.rb', line 7

def self.build_for(events_message, result: 0)
  new(
    tid: events_message.tid,
    bid: events_message.bid,
    timestamp: current_timestamp,
    data: {
      result: result
    }
  )
end

Instance Method Details

#humanized_summaryObject



31
32
33
# File 'lib/dji_mqtt_connect/messages/thing/product/state_reply_message.rb', line 31

def humanized_summary
  Translations.thing_product_state_reply_summary(**humanized_summary_interpolation)
end

#humanized_summary_interpolationObject



35
36
37
# File 'lib/dji_mqtt_connect/messages/thing/product/state_reply_message.rb', line 35

def humanized_summary_interpolation
  data.to_h
end