Sha256: 3fe9f639c525fb96670cfd69b3aaa57b6f9f8da0e49f9769409c8662e3330da0
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true module CoinsPaid module API class CallbackData < Dry::Struct NOT_CONFIRMED = 'not_confirmed' CANCELLED = 'cancelled' attribute :id, Types::Integer attribute? :foreign_id, Types::String attribute? :type, Types::String attribute? :status, Types::String attribute? :error, Types::Coercible::String attribute? :crypto_address do attribute :currency, Types::String end attribute? :transactions, Types::Array do attribute :transaction_type, Types::String attribute :type, Types::String attribute :id, Types::Integer end attribute? :currency_sent do attribute :currency, Types::String attribute :amount, Types::String end attribute? :currency_received do attribute :currency, Types::String attribute :amount, Types::String attribute? :amount_minus_fee, Types::String end def self.from_json(attributes) attributes[:foreign_id] ||= attributes.dig(:crypto_address, :foreign_id) || '' new(attributes) end def pending? status == NOT_CONFIRMED end def cancelled? status == CANCELLED end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
coins_paid_api-2.0.0 | lib/coins_paid/api/callback_data.rb |
coins_paid_api-1.3.0 | lib/coins_paid/api/callback_data.rb |
coins_paid_api-1.2.0 | lib/coins_paid/api/callback_data.rb |