Class: Economic::DebtorContact

Inherits:
Entity
  • Object
show all
Defined in:
lib/economic/debtor_contact.rb

Overview

Represents a debtor contact.

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

Examples

# Find contact
contact = economic.contacts.find(5)

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

Instance Attribute Summary

Attributes inherited from Entity

#partial, #persisted, #session

Instance Method Summary collapse

Methods inherited from Entity

#get_data, has_properties, #id, #initialize, #initialize_defaults, #inspect, #number, #partial?, #persisted?, properties, properties_not_triggering_full_load, proxy, #proxy, #save, soap_action, #update_properties

Constructor Details

This class inherits a constructor from Economic::Entity

Instance Method Details

#debtorObject



23
24
25
26
# File 'lib/economic/debtor_contact.rb', line 23

def debtor
  return nil if debtor_handle.blank?
  @debtor ||= session.debtors.find(debtor_handle)
end

#debtor=(debtor) ⇒ Object



28
29
30
31
# File 'lib/economic/debtor_contact.rb', line 28

def debtor=(debtor)
  self.debtor_handle = debtor.handle
  @debtor = debtor
end

#debtor_handle=(handle) ⇒ Object



33
34
35
36
# File 'lib/economic/debtor_contact.rb', line 33

def debtor_handle=(handle)
  @debtor = nil unless handle == @debtor_handle
  @debtor_handle = handle
end

#handleObject



38
39
40
# File 'lib/economic/debtor_contact.rb', line 38

def handle
  Handle.new({:id => @id})
end