Sha256: 7a6acf79f3ef5a19441b8c78fcdf7c5f0acb6a9860c2d900c1bee8c592555d36

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

module OmiseGO
  class Balance < Base
    attributes :amount, :minted_token

    class << self
      def all(provider_user_id:, client: nil)
        request(client).send('user.list_balances', provider_user_id: provider_user_id).data
      end

      def credit(provider_user_id:, token_id:, amount:, metadata: {}, idempotency_token:,
                 account_id: nil, burn_balance_identifier: nil, client: nil)
        request(client)
          .send('user.credit_balance', provider_user_id: provider_user_id,
                                       token_id: token_id,
                                       amount: amount,
                                       metadata: metadata,
                                       account_id: account_id,
                                       burn_balance_identifier: burn_balance_identifier,
                                       idempotency_token: idempotency_token).data
      end

      def debit(provider_user_id:, token_id:, amount:, metadata: {}, idempotency_token:,
                account_id: nil, burn_balance_identifier: nil, client: nil)
        request(client)
          .send('user.debit_balance', provider_user_id: provider_user_id,
                                      token_id: token_id,
                                      amount: amount,
                                      metadata: metadata,
                                      account_id: account_id,
                                      burn_balance_identifier: burn_balance_identifier,
                                      idempotency_token: idempotency_token).data
      end
    end

    def minted_token
      @_minted_token ||= MintedToken.new(@minted_token)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omisego-0.9.6 lib/omisego/balance.rb
omisego-0.9.5 lib/omisego/balance.rb
omisego-0.9.4 lib/omisego/balance.rb