class Round::Account

Attributes

wallet[RW]

Public Class Methods

hash_identifier() click to toggle source
# File lib/round/account.rb, line 37
def self.hash_identifier
  "name"
end
new(options = {}) click to toggle source
Calls superclass method Round::Base::new
# File lib/round/account.rb, line 8
def initialize(options = {})
  raise ArgumentError, 'Account must be associated with a wallet' unless options[:wallet]
  super(options)
  @wallet = options[:wallet]
end

Public Instance Methods

pay(payees, confirmations, redirect_uri = nil, mfa_token: nil) click to toggle source
# File lib/round/account.rb, line 22
def pay(payees, confirmations, redirect_uri = nil, mfa_token: nil)
  raise 'You must unlock the wallet before attempting a transaction' unless @wallet.multiwallet

  payment = self.transactions.create(payees, confirmations)
  signed = payment.sign(@wallet.multiwallet, 
                        redirect_uri: redirect_uri, 
                        network: network.to_sym)
  if wallet.application
    mfa_token = mfa_token || @wallet.application.get_mfa
    signed.approve(mfa_token)
    signed.refresh
  end
  signed
end
transactions(**query) click to toggle source
# File lib/round/account.rb, line 14
def transactions(**query)
  query[:status] = query[:status].join(',') if query[:status]
  Round::TransactionCollection.new(
    resource: @resource.transactions(query),
    client: @client
  )
end