Sha256: 7c7311ae61f3020b3daa640f41ad21df141c1df9bb526f989fca196f09e8315a

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

# typed: strict
# frozen_string_literal: true

module WhatsappSdk
  module Resource
    class Currency
      extend T::Sig

      # Returns default text if localization fails.
      #
      # @returns fallback_value [String].
      sig { returns(String) }
      attr_accessor :fallback_value

      # Currency code as defined in ISO 4217.
      #
      # @returns code [String].
      sig { returns(String) }
      attr_accessor :code

      # Amount multiplied by 1000.
      #
      # @returns code [Float].
      sig { returns(T.any(Float, Integer)) }
      attr_accessor :amount

      sig { params(fallback_value: String, code: String, amount: T.any(Float, Integer)).void }
      def initialize(fallback_value:, code:, amount:)
        @fallback_value = fallback_value
        @code = code
        @amount = amount
      end

      sig { returns(T::Hash[T.untyped, T.untyped]) }
      def to_json
        {
          fallback_value: fallback_value,
          code: code,
          amount_1000: amount
        }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
whatsapp_sdk-0.12.1 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.12.0 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.11.0 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.10.0 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.9.2 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.9.1 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.9.0 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.8.0 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.7.3 lib/whatsapp_sdk/resource/currency.rb
whatsapp_sdk-0.7.2 lib/whatsapp_sdk/resource/currency.rb