Class: Round::Account
Instance Attribute Summary collapse
-
#wallet ⇒ Object
Returns the value of attribute wallet.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Account
constructor
A new instance of Account.
- #pay(payees, confirmations, redirect_uri = nil, mfa_token: nil) ⇒ Object
- #transactions(**query) ⇒ Object
Methods inherited from Base
association, #hash_identifier, #method_missing, #refresh
Constructor Details
#initialize(options = {}) ⇒ Account
Returns a new instance of Account.
8 9 10 11 12 |
# File 'lib/round/account.rb', line 8 def initialize( = {}) raise ArgumentError, 'Account must be associated with a wallet' unless [:wallet] super() @wallet = [:wallet] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Round::Base
Instance Attribute Details
#wallet ⇒ Object
Returns the value of attribute wallet.
6 7 8 |
# File 'lib/round/account.rb', line 6 def wallet @wallet end |
Class Method Details
.hash_identifier ⇒ Object
37 38 39 |
# File 'lib/round/account.rb', line 37 def self.hash_identifier "name" end |
Instance Method Details
#pay(payees, confirmations, redirect_uri = nil, mfa_token: nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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) ⇒ Object
14 15 16 17 18 19 20 |
# 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 |