Class: Economic::CreditorContact

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

Overview

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

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

#creditorObject



24
25
26
27
# 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) ⇒ Object



29
30
31
32
# File 'lib/economic/creditor_contact.rb', line 29

def creditor=(creditor)
  self.creditor_handle = creditor.handle
  @creditor = creditor
end

#creditor_handle=(handle) ⇒ Object



34
35
36
37
# File 'lib/economic/creditor_contact.rb', line 34

def creditor_handle=(handle)
  @creditor = nil unless handle == @creditor_handle
  @creditor_handle = handle
end

#handleObject



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

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