Sha256: 541a61860f42a43f784342fc1abf7692e8019d090aeff66f74745da592a7eaad

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Thing::Product
    class ServicesReplyMessage < DjiMqttConnect::Message
      attribute :tid, Types::UUID
      attribute :bid, Types::UUID
      attribute :timestamp, Types::Timestamp

      attribute :_data, Types::Hash
      attribute :_method, Types::String

      attribute :data do
        include Mixins::ResultMessage

        attribute :result, Types::ResultCode
      end

      def humanized_summary
        Translations.thing_product_services_reply_summary(_method, **humanized_summary_interpolation)
      end

      def humanized_summary_interpolation
        data.to_h.merge(method: _method)
      end

      def to_s
        # Include data method for Generic messages
        instance_of?(ServicesReplyMessage) ? "#{super}[#{_method}]" : super
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dji_mqtt_connect-0.1.25.1 lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb
dji_mqtt_connect-0.1.25 lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb