Class: Bitcoind::Account

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::Memoizable
Defined in:
lib/bitcoind/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, name) ⇒ Account

Returns a new instance of Account.



6
7
8
9
# File 'lib/bitcoind/account.rb', line 6

def initialize(client, name)
  @client = client
  self.name = name
end

Instance Attribute Details

#balanceObject

Returns the value of attribute balance.



4
5
6
# File 'lib/bitcoind/account.rb', line 4

def balance
  @balance
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/bitcoind/account.rb', line 4

def name
  @name
end

Instance Method Details

#addressObject



25
26
27
# File 'lib/bitcoind/account.rb', line 25

def address
  @client.request 'getaccountaddress', self.name
end

#inspectObject



11
12
13
# File 'lib/bitcoind/account.rb', line 11

def inspect
  "#<Bitcoind::Account #{self.name.inspect} >"
end

#send_to(destination, amount) ⇒ Object



15
16
17
18
# File 'lib/bitcoind/account.rb', line 15

def send_to(destination, amount)
  txn_id = @client.request 'sendfrom', self.name, destination, amount
  Transaction.new @clientm, self, txn_id
end

#transactionsObject



30
31
32
33
34
35
36
# File 'lib/bitcoind/account.rb', line 30

def transactions
  txn_array = @client.request 'listtransactions', self.name

  txn_array.map do |h|
    Transaction.new @client, self, h['txid']
  end
end