Class: Bitbank::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/bitbank/transaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, txid, data = {}) ⇒ Transaction

Returns a new instance of Transaction.



5
6
7
8
9
10
# File 'lib/bitbank/transaction.rb', line 5

def initialize(client, txid, data={})
  @client = client
  @txid = txid

  load_details(data)
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



3
4
5
# File 'lib/bitbank/transaction.rb', line 3

def address
  @address
end

#amountObject (readonly)

Returns the value of attribute amount.



3
4
5
# File 'lib/bitbank/transaction.rb', line 3

def amount
  @amount
end

#categoryObject (readonly)

Returns the value of attribute category.



3
4
5
# File 'lib/bitbank/transaction.rb', line 3

def category
  @category
end

#confirmationsObject (readonly)

Returns the value of attribute confirmations.



3
4
5
# File 'lib/bitbank/transaction.rb', line 3

def confirmations
  @confirmations
end

#txidObject (readonly)

Returns the value of attribute txid.



3
4
5
# File 'lib/bitbank/transaction.rb', line 3

def txid
  @txid
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
# File 'lib/bitbank/transaction.rb', line 24

def ==(other)
  txid == other.txid
end

#accountObject



12
13
14
# File 'lib/bitbank/transaction.rb', line 12

def 
  @account ? Account.new(@client, @account) : nil
end

#confirmed?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/bitbank/transaction.rb', line 20

def confirmed?
  confirmations && confirmations > 6
end

#timeObject



16
17
18
# File 'lib/bitbank/transaction.rb', line 16

def time
  Time.at(@time)
end