class Kojn::Invoice
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]
source_currency[RW]
status[RW]
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/invoice.rb, line 27 def new_record? self.internal_id == nil end
save()
click to toggle source
# File lib/kojn/invoice.rb, line 15 def save # Uses the invoices helper class to create and update # Copies the returned invoices' attributes over to its own. if self.new_record? self.attributes = Kojn.invoices.create(self.attributes).attributes else self.attributes = Kojn.invoices.update(self.internal_id, self.attributes).attributes end end