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(:id => 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

#id, #number, #partial, #persisted, #session

Instance Method Summary collapse

Methods inherited from Entity

#==, default_values, defaults, #destroy, #get, #get_data, #handle=, handle_writer, has_properties, #initialize, #inspect, key, #partial?, #persisted?, properties, properties_not_triggering_full_load, property_reader, property_writer, proxy, #proxy, #save, #update_properties

Constructor Details

This class inherits a constructor from Economic::Entity

Instance Method Details

#debtorObject



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

def debtor
  return nil if debtor_handle.nil?
  @debtor ||= session.debtors.find(debtor_handle[:number])
end

#debtor=(debtor) ⇒ Object



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

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

#debtor_handle=(handle) ⇒ Object



43
44
45
46
# File 'lib/economic/debtor_contact.rb', line 43

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

#handleObject



48
49
50
# File 'lib/economic/debtor_contact.rb', line 48

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