class Bitbank::Transaction
Attributes
address[R]
amount[R]
category[R]
confirmations[R]
txid[R]
Public Class Methods
new(client, txid, data={})
click to toggle source
# File lib/bitbank/transaction.rb, line 5 def initialize(client, txid, data={}) @client = client @txid = txid load_details(data) end
Public Instance Methods
==(other)
click to toggle source
# File lib/bitbank/transaction.rb, line 24 def ==(other) txid == other.txid end
account()
click to toggle source
# File lib/bitbank/transaction.rb, line 12 def account @account ? Account.new(@client, @account) : nil end
confirmed?()
click to toggle source
# File lib/bitbank/transaction.rb, line 20 def confirmed? confirmations && confirmations > 6 end
time()
click to toggle source
# File lib/bitbank/transaction.rb, line 16 def time Time.at(@time) end
Private Instance Methods
load_details(data={})
click to toggle source
# File lib/bitbank/transaction.rb, line 30 def load_details(data={}) data = @client.request('gettransaction', txid) if data.empty? data.symbolize_keys! details = ((data.delete(:details) || []).first || {}).symbolize_keys @account = data[:account] || details[:account] @address = data[:address] || details[:address] @category = data[:category] || details[:category] @amount = data[:amount] || details[:amount] @confirmations = data[:confirmations] @time = data[:time] end