Sha256: 04b2d0b23637c333382706bd2b093156a22e2ca33ecf824c5547e71e7d457555

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Thing::Product
    class FlightAreasSyncProgressEventsMessage < EventsMessage
      attribute :_method, Types::String.enum("flight_areas_sync_progress")

      attribute :data do
        attribute :file, (Class.new(Dry::Struct) do
          attribute :name, Types::String
          attribute :checksum, Types::String
        end) | Types::Nil

        # {"wait_sync":"wait for synchronize","synchronizing":"synchronizing","synchronized":"synchronized","fail":"Fail"}
        attribute :status, Types::String.enum(
          "wait_sync",
          "synchronizing",
          "synchronized",
          "fail"
        )

        # {"1":"Failed to parse file information returned from the cloud.","2":"Failed to retrieve file information from the aircraft's end.","3":"Failed to download the file from the cloud.","4":"Link flipping failed.","5":"File transmission failed."}
        attribute :reason, Types::Integer.enum(0, 1, 2, 3, 4, 5)

        def humanized_reason
          I18n.t(reason, scope: "dji_mqtt_connect.thing_product_flight_areas_sync_progress_events_message.humanized_reason")
        end
      end

      def humanized_summary_interpolation
        super.merge(reason: data.humanized_reason)
      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/events/flight_areas_sync_progress.rb
dji_mqtt_connect-0.1.25 lib/dji_mqtt_connect/messages/thing/product/events/flight_areas_sync_progress.rb