Class: Kaui::Invoice
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#amount_to_money(currency) ⇒ Object
TODO - fix invoice json to return the currency.
- #balance_to_money(currency) ⇒ Object
- #credit_adjustment_to_money(currency) ⇒ Object
- #credit_balance_adjustment_to_money(currency) ⇒ Object
-
#initialize(data = {}) ⇒ Invoice
constructor
A new instance of Invoice.
- #payment_amount_to_money(currency) ⇒ Object
- #refund_adjustment_to_money(currency) ⇒ Object
Methods inherited from Base
#==, all, #attributes=, camelize, convert_hash_keys, count, define_attr, #destroy, find, from_json, has_many, has_one, human_attribute_name, lookup_ancestors, #new_record?, #persisted?, #read_attribute_for_validation, #save, #to_hash, to_money, #to_param, #update_attributes
Constructor Details
#initialize(data = {}) ⇒ Invoice
Returns a new instance of Invoice.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/kaui/invoice.rb', line 19 def initialize(data = {}) super(:account_id => data['accountId'], :amount => data['amount'], :balance => data['balance'], :credit_balance_adjustment => data['cba'], :credit_adjustment => data['creditAdj'], :invoice_date => data['invoiceDate'], :invoice_id => data['invoiceId'], :invoice_number => data['invoiceNumber'], :refund_adjustment => data['refundAdj'], :target_date => data['targetDate'], :items => data['items'] || [], :bundle_keys => data['bundleKeys'], :audit_logs => data['auditLogs']) end |
Instance Method Details
#amount_to_money(currency) ⇒ Object
TODO - fix invoice json to return the currency
37 38 39 |
# File 'app/models/kaui/invoice.rb', line 37 def amount_to_money(currency) Kaui::Base.to_money(amount, currency) end |
#balance_to_money(currency) ⇒ Object
41 42 43 |
# File 'app/models/kaui/invoice.rb', line 41 def balance_to_money(currency) Kaui::Base.to_money(balance, currency) end |
#credit_adjustment_to_money(currency) ⇒ Object
57 58 59 |
# File 'app/models/kaui/invoice.rb', line 57 def credit_adjustment_to_money(currency) Kaui::Base.to_money(credit_adjustment, currency) end |
#credit_balance_adjustment_to_money(currency) ⇒ Object
53 54 55 |
# File 'app/models/kaui/invoice.rb', line 53 def credit_balance_adjustment_to_money(currency) Kaui::Base.to_money(credit_balance_adjustment, currency) end |