class Economic::CreditorContact

Represents a creditor contact.

API documentation: www.e-conomic.com/apidocs/Documentation/T_Economic_Api_ICreditorContact.html

Examples

# Find contact
contact = economic.contacts.find(:id => 5)

# Creating a contact
contact = creditor.contacts.build
contact.id = 0
contact.number = 0
contact.name = 'John Appleseed'
contact.save

Public Instance Methods

creditor() click to toggle source
# File lib/economic/creditor_contact.rb, line 24
def creditor
  return nil if creditor_handle.nil?
  @creditor ||= session.creditors.find(creditor_handle[:number])
end
creditor=(creditor) click to toggle source
# File lib/economic/creditor_contact.rb, line 29
def creditor=(creditor)
  self.creditor_handle = creditor.handle
  @creditor = creditor
end
creditor_handle=(handle) click to toggle source
# File lib/economic/creditor_contact.rb, line 34
def creditor_handle=(handle)
  @creditor = nil unless handle == @creditor_handle
  @creditor_handle = handle
end
handle() click to toggle source
# File lib/economic/creditor_contact.rb, line 39
def handle
  @handle || Handle.build(:id => @id)
end

Protected Instance Methods

fields() click to toggle source
# File lib/economic/creditor_contact.rb, line 45
def fields
  to_hash = proc { |handle| handle.to_hash }
  # SOAP field, entity method, formatter proc, required?
  [
    ["Handle", :handle, proc { |v| v.to_hash }, :required],
    ["Id", :id, nil],
    ["CreditorHandle", :creditor_handle, to_hash],
    ["Name", :name],
    ["Number", :handle, proc { |v| v.number }, :required],
    ["TelephoneNumber", :telephone_number],
    ["Email", :email],
    ["Comments", :comments],
    ["ExternalId", :external_id]
  ]
end