Sha256: bc6378190012e363c9f694210c2dab4159ed0f507eaef51ff861e0dca8166ad9

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module OmiseGO
  class Transaction < Base
    attributes :id, :idempotency_token, :from, :to, :exchange,
               :metadata, :encrypted_metadata, :status, :created_at

    class << self
      def all(params: {}, client: nil)
        if params[:provider_user_id]
          all_for_user(
            provider_user_id: params[:provider_user_id],
            address: params[:address],
            params: params,
            client: client
          )
        else
          request(client).send('transaction.all', {}, params: params).data
        end
      end

      def all_for_user(provider_user_id:, address: nil, params: {}, client: nil)
        body = {
          provider_user_id: provider_user_id,
          address:          address
        }

        request(client).send('user.list_transactions', body, params: params).data
      end
    end

    def from
      @_from ||= TransactionSource.new(@from)
    end

    def to
      @_to ||= TransactionSource.new(@to)
    end

    def exchange
      @_exchange ||= Exchange.new(@exchange)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omisego-0.9.6 lib/omisego/transaction.rb