Sha256: 7bddfce9dd71a3eb1df04b6e79b831020d5c93a7c2b7690190b5c8886c96a779

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Thing::Product
    # https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/organization.html#device-bind-to-organization
    class AirportOrganizationBindRequestsMessage < RequestsMessage
      attribute :_method, Types::String.enum("airport_organization_bind")

      attribute :data do
        attribute :bind_devices, Types::Array do
          attribute :device_binding_code, Types::String | Types::Nil
          attribute :organization_id, Types::String | Types::Nil
          attribute :device_callsign, Types::String | Types::Nil
          attribute :sn, Types::SerialNumber | Types::Nil
          attribute :device_model_key, Types::String
          attribute :device_nonce, Types::String | Types::Nil
          attribute :device_secret, Types::String | Types::Nil

          def humanized_summary
            I18n.t(
              "dji_mqtt_connect.thing_product_airport_organization_bind_requests_message.bind_devices_summary",
              **to_h,
              identifier: sn || device_model_key
            )
          end
        end
      end

      def humanized_summary_interpolation
        super.merge(
          bind_status: data.bind_devices.map(&:humanized_summary).join(", ")
        )
      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/requests/airport_organization_bind.rb
dji_mqtt_connect-0.1.25 lib/dji_mqtt_connect/messages/thing/product/requests/airport_organization_bind.rb