Class: Kojn::Invoice
Constant Summary collapse
- UNCONFIRMED =
1
- INSUFFICIENT =
2
- SEEN =
3
- CANCELLED =
4
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#amount_in_fiat ⇒ Object
Returns the value of attribute amount_in_fiat.
-
#amount_left ⇒ Object
Returns the value of attribute amount_left.
-
#confirmed ⇒ Object
Returns the value of attribute confirmed.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#description ⇒ Object
Returns the value of attribute description.
-
#error ⇒ Object
Returns the value of attribute error.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#exchange_rate ⇒ Object
Returns the value of attribute exchange_rate.
-
#external_id ⇒ Object
Returns the value of attribute external_id.
-
#internal_id ⇒ Object
Returns the value of attribute internal_id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#paid ⇒ Object
Returns the value of attribute paid.
-
#received_amount ⇒ Object
Returns the value of attribute received_amount.
-
#received_amount_in_fiat ⇒ Object
Returns the value of attribute received_amount_in_fiat.
-
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
-
#seen ⇒ Object
Returns the value of attribute seen.
-
#source_currency ⇒ Object
Returns the value of attribute source_currency.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#new_record? ⇒ Boolean
Returns whether this ‘record’ is new.
- #save ⇒ Object
Methods inherited from Model
#attributes, #attributes=, #initialize
Constructor Details
This class inherits a constructor from Kojn::Model
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def address @address end |
#amount ⇒ Object
Returns the value of attribute amount.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def amount @amount end |
#amount_in_fiat ⇒ Object
Returns the value of attribute amount_in_fiat.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def amount_in_fiat @amount_in_fiat end |
#amount_left ⇒ Object
Returns the value of attribute amount_left.
12 13 14 |
# File 'lib/kojn/invoice.rb', line 12 def amount_left @amount_left end |
#confirmed ⇒ Object
Returns the value of attribute confirmed.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def confirmed @confirmed end |
#currency ⇒ Object
Returns the value of attribute currency.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def currency @currency end |
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def description @description end |
#error ⇒ Object
Returns the value of attribute error.
13 14 15 |
# File 'lib/kojn/invoice.rb', line 13 def error @error end |
#errors ⇒ Object
Returns the value of attribute errors.
13 14 15 |
# File 'lib/kojn/invoice.rb', line 13 def errors @errors end |
#exchange_rate ⇒ Object
Returns the value of attribute exchange_rate.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def exchange_rate @exchange_rate end |
#external_id ⇒ Object
Returns the value of attribute external_id.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def external_id @external_id end |
#internal_id ⇒ Object
Returns the value of attribute internal_id.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def internal_id @internal_id end |
#message ⇒ Object
Returns the value of attribute message.
13 14 15 |
# File 'lib/kojn/invoice.rb', line 13 def @message end |
#paid ⇒ Object
Returns the value of attribute paid.
12 13 14 |
# File 'lib/kojn/invoice.rb', line 12 def paid @paid end |
#received_amount ⇒ Object
Returns the value of attribute received_amount.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def received_amount @received_amount end |
#received_amount_in_fiat ⇒ Object
Returns the value of attribute received_amount_in_fiat.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def received_amount_in_fiat @received_amount_in_fiat end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
12 13 14 |
# File 'lib/kojn/invoice.rb', line 12 def redirect_uri @redirect_uri end |
#seen ⇒ Object
Returns the value of attribute seen.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def seen @seen end |
#source_currency ⇒ Object
Returns the value of attribute source_currency.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def source_currency @source_currency end |
#status ⇒ Object
Returns the value of attribute status.
11 12 13 |
# File 'lib/kojn/invoice.rb', line 11 def status @status end |
Instance Method Details
#new_record? ⇒ Boolean
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.
27 28 29 |
# File 'lib/kojn/invoice.rb', line 27 def new_record? self.internal_id == nil end |
#save ⇒ Object
15 16 17 18 19 20 21 22 23 |
# 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 |