module Invoicexpress::Models::ExtraInvoice

Fields only available with GET request

Public Class Methods

included(base) click to toggle source
# 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 :permalink, String
  end
end

Public Instance Methods

to_core() click to toggle source
# File lib/invoicexpress/models/invoice.rb, line 83
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