Sha256: 30ccaf6c5978d7a3109e80fc8ce0edaa79d093212adbf72d307278b4d6b76430
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 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 :id, Types::Integer end attribute? :currency_sent do attribute :amount, Types::String end attribute? :currency_received do 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-1.0.2 | lib/coins_paid/api/callback_data.rb |