Class: BitWallet::Wallet
- Inherits:
-
Object
- Object
- BitWallet::Wallet
- Defined in:
- lib/bit_wallet/wallet.rb
Instance Method Summary collapse
- #accounts ⇒ Object
- #client ⇒ Object
-
#initialize(config = {}) ⇒ Wallet
constructor
A new instance of Wallet.
- #move(from_account, to_account, amount, min_conf = BitWallet.min_conf, comment = nil) ⇒ Object
- #recent_transactions(options = {}) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Wallet
Returns a new instance of Wallet.
4 5 6 |
# File 'lib/bit_wallet/wallet.rb', line 4 def initialize(config={}) @config = config end |
Instance Method Details
#accounts ⇒ Object
8 9 10 |
# File 'lib/bit_wallet/wallet.rb', line 8 def accounts @accounts ||= Accounts.new(self) end |
#client ⇒ Object
42 43 44 |
# File 'lib/bit_wallet/wallet.rb', line 42 def client @client ||= InstantiatesBitcoinClient.execute(@config) end |
#move(from_account, to_account, amount, min_conf = BitWallet.min_conf, comment = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bit_wallet/wallet.rb', line 19 def move(from_account, to_account, amount, min_conf=BitWallet.min_conf, comment=nil) from_account_str = if from_account.respond_to?(:name) from_account.name else from_account end to_account_str = if to_account.respond_to?(:name) to_account.name else to_account end client.move(from_account_str, to_account_str, amount, min_conf, comment) end |
#recent_transactions(options = {}) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/bit_wallet/wallet.rb', line 12 def recent_transactions(={}) count = .delete(:limit) || 10 client.listtransactions('*', count).map do |hash| Transaction.new self, hash end end |