class Kojn::Tx
Constants
- CANCELLED
- INSUFFICIENT
- SEEN
- UNCONFIRMED
Attributes
address[RW]
amount[RW]
amount_in_fiat[RW]
amount_left[RW]
confirmed[RW]
currency[RW]
description[RW]
error[RW]
errors[RW]
exchange_rate[RW]
external_id[RW]
internal_id[RW]
message[RW]
paid[RW]
received_amount[RW]
received_amount_in_fiat[RW]
redirect_uri[RW]
seen[RW]
status[RW]
time_left[RW]
Public Class Methods
new(attributes = {})
click to toggle source
# File lib/kojn/transaction.rb, line 50 def initialize(attributes = {}) self.attributes = attributes end
Public Instance Methods
new_record?()
click to toggle source
Returns whether this 'record' is new. Inspired by rails :) TODO Make sure if a newly initialized object's internal_id
is actually set to nil.
# File lib/kojn/transaction.rb, line 75 def new_record? self.internal_id == nil end
save()
click to toggle source
# File lib/kojn/transaction.rb, line 63 def save # Uses the transactions helper class to create and update # Copies the returned transactions' attributes over to its own. if self.new_record? self.attributes = Kojn.transactions.create(self.attributes).attributes else self.attributes = Kojn.transactions.update(self.internal_id, self.attributes).attributes end end