Sha256: b2a0c3958487458f276afd0e6f3516c8296d3e8034f4f1a01f4344d99277adec
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 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 attribute :address, Types::String end attribute? :transactions, Types::Array do attribute :transaction_type, Types::String attribute :type, Types::String attribute :id, Types::Integer attribute? :txid, Types::String 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coins_paid_api-2.2.0 | lib/coins_paid/api/callback_data.rb |