lib/bit_wallet/account.rb in bit_wallet-0.0.3 vs lib/bit_wallet/account.rb in bit_wallet-0.1.0

- old
+ new

@@ -17,22 +17,34 @@ def balance(min_conf=BitWallet.config.min_conf) client.getbalance(self.name, min_conf) end def send_amount(amount, options={}) - unless options[:to] + if options[:to] + options[:to] = options[:to].address if options[:to].is_a?(Address) + else fail ArgumentError, 'address must be specified' end + client.sendfrom(self.name, options[:to], amount, BitWallet.config.min_conf) rescue RestClient::InternalServerError => e parse_error e.response end def total_received client.getreceivedbyaccount(self.name, BitWallet.config.min_conf) + end + + def ==(other_account) + self.name == other_account.name + end + + def recent_transactions(options={}) + count = options.delete(:limit) || 10 + client.listtransactions self.name, count end private def parse_error(response)