Sha256: 9f221aba4d14d60d9c48cb148869d65240e65ddddd896b0148146c428c370487
Contents?: true
Size: 1000 Bytes
Versions: 2
Compression:
Stored size: 1000 Bytes
Contents
# frozen_string_literal: true module DjiMqttConnect module Thing::Product class AlarmStateSwitchServicesMessage < ServicesMessage ACTION_OPEN = 1 ACTION_CLOSE = 0 def self.build(action:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp) new( bid: bid, tid: tid, timestamp: timestamp, _method: "alarm_state_switch", data: { action: action } ) end attribute :_method, Types::String.enum("alarm_state_switch") attribute :data do # {"0":"Close","1":"Open"} attribute :action, Types::Integer.enum(ACTION_CLOSE, ACTION_OPEN) def humanized_action I18n.t(action, scope: "dji_mqtt_connect.thing_product_alarm_state_switch_services_message.humanized_action") end end def humanized_summary_interpolation super.merge( action: data.humanized_action ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems