Module: Invoicexpress::Models::ExtraInvoice
- Included in:
- CashInvoice, CreditNote, DebitNote, Invoice, SimplifiedInvoice
- Defined in:
- lib/invoicexpress/models/invoice.rb
Overview
Fields only available with GET request
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/invoicexpress/models/invoice.rb', line 69 def self.included(base) base.class_eval do element :status, String element :sequence_number, String element :currency, String element :sum, Float element :discount, Float element :before_taxes, Float element :taxes, Float element :total, Float element :mb_reference, Integer element :permalink, String end end |
Instance Method Details
#to_core ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/invoicexpress/models/invoice.rb', line 84 def to_core() fields={:date => self.date, :due_date => self.due_date, :reference=> self.reference, :observations=> self.observations, :retention=> self.retention, :tax_exemption => self.tax_exemption, :sequence_id=> self.sequence_id, :client => self.client, :items => self.items, :mb_reference=> self.mb_reference} case self.class.to_s when "Invoicexpress::Models::SimplifiedInvoice" invoice = Invoicexpress::Models::CoreSimplifiedInvoice.new(fields) when "Invoicexpress::Models::CashInvoice" invoice = Invoicexpress::Models::CoreCashInvoice.new(fields) when "Invoicexpress::Models::CreditNote" invoice = Invoicexpress::Models::CoreCreditNote.new(fields) when "Invoicexpress::Models::DebitNote" invoice = Invoicexpress::Models::CoreDebitNote.new(fields) else invoice = Invoicexpress::Models::CoreInvoice.new(fields) end end |