class Economic::Debtor
Represents a debtor in E-conomic.
API documentation: www.e-conomic.com/apidocs/Documentation/T_Economic_Api_IDebtor.html
Examples
# Find a debtor: debtor = economic.debtors.find(558) # Creating a debtor: debtor = economic.debtors.build debtor.number = economic.debtors.next_available_number debtor.debtor_group_handle = { :number => 1 } debtor.name = 'Apple Inc' debtor.vat_zone = 'HomeCountry' # HomeCountry, EU, Abroad debtor.currency_handle = { :code => 'DKK' } debtor.price_group_handle = { :number => 1 } debtor.is_accessible = true debtor.ci_number = '12345678' debtor.term_of_payment_handle = { :id => 1 } debtor.layout_handle = { :id => 16 } debtor.save
Public Instance Methods
contacts()
click to toggle source
Returns the Debtors contacts
# File lib/economic/debtor.rb, line 74 def contacts return [] if handle.empty? @contacts ||= DebtorProxy.new(self).get_debtor_contacts(handle) end
current_invoices()
click to toggle source
Provides access to the current invoices for Debtor
- ie invoices that haven't yet been booked
# File lib/economic/debtor.rb, line 62 def current_invoices @current_invoices ||= CurrentInvoiceProxy.new(self) end
get_current_invoices()
click to toggle source
Provides access to the current invoices for Debtor
- ie invoices that haven't yet been booked
# File lib/economic/debtor.rb, line 68 def get_current_invoices return [] if handle.empty? @current_invoices ||= DebtorProxy.new(self).get_current_invoices(handle) end
handle()
click to toggle source
# File lib/economic/debtor.rb, line 56 def handle @handle || Handle.new(:number => @number) end
invoices()
click to toggle source
# File lib/economic/debtor.rb, line 79 def invoices return [] if handle.empty? @invoices ||= DebtorProxy.new(self).get_invoices(handle) end
orders()
click to toggle source
# File lib/economic/debtor.rb, line 84 def orders return [] if handle.empty? @orders ||= DebtorProxy.new(self).get_orders(handle) end
Protected Instance Methods
fields()
click to toggle source
# File lib/economic/debtor.rb, line 91 def fields to_hash = proc { |handle| handle.to_hash } [ ["Handle", :handle, to_hash, :required], ["Number", :handle, proc { |h| h.number }, :required], ["DebtorGroupHandle", :debtor_group_handle, to_hash], ["Name", :name, nil, :required], ["VatZone", :vat_zone, nil, :required], ["CurrencyHandle", :currency_handle, to_hash], ["PriceGroupHandle", :price_group_handle, to_hash], ["IsAccessible", :is_accessible, nil, :required], ["Ean", :ean], ["PublicEntryNumber", :public_entry_number], ["Email", :email], ["TelephoneAndFaxNumber", :telephone_and_fax_number], ["Website", :website], ["Address", :address], ["PostalCode", :postal_code], ["City", :city], ["Country", :country], ["CreditMaximum", :credit_maximum], ["VatNumber", :vat_number], ["County", :county], ["CINumber", :ci_number], ["TermOfPaymentHandle", :term_of_payment_handle, to_hash], ["LayoutHandle", :layout_handle, to_hash], ["AttentionHandle", :attention_handle], ["YourReferenceHandle", :your_reference_handle], ["OurReferenceHandle", :our_reference_handle], ["Balance", :balance] ] end