Sha256: 252c402369ec8ef52d2ea37761132041b983d7bc2311bba6fab3d1c03c323756

Contents?: true

Size: 1.84 KB

Versions: 2

Compression:

Stored size: 1.84 KB

Contents

require "xeroizer/models/contact_person"

module Xeroizer
  module Record

    class ContactModel < BaseModel

      set_permissions :read, :write, :update

    end

    class Contact < Base

      CONTACT_STATUS = {
        'ACTIVE' =>     'Active',
        'DELETED' =>    'Deleted',
        'ARCHIVED' => 'Archived'
      } unless defined?(CONTACT_STATUS)

      set_primary_key :contact_id
      set_possible_primary_keys :contact_id, :contact_number
      list_contains_summary_only true

      guid          :contact_id
      string        :contact_number
      string        :contact_status
      string        :account_number
      string        :name
      string        :tax_number
      string        :bank_account_details
      string        :accounts_receivable_tax_type
      string        :accounts_payable_tax_type
      string        :first_name
      string        :last_name
      string        :email_address
      string        :skype_user_name
      string        :contact_groups
      string        :default_currency
      string        :purchases_default_account_code 
      string        :sales_default_account_code 
      datetime_utc  :updated_date_utc, :api_name => 'UpdatedDateUTC'
      boolean       :is_supplier
      boolean       :is_customer
      
      has_many  :addresses, :list_complete => true
      has_many  :phones, :list_complete => true
      has_many  :contact_groups
      has_many  :contact_persons, :internal_name => :contact_people

      has_many :sales_tracking_categories, :model_name => 'ContactSalesTrackingCategory'
      has_many :purchases_tracking_categories, :model_name => 'ContactPurchasesTrackingCategory'

      validates_presence_of :name
      validates_inclusion_of :contact_status, :in => CONTACT_STATUS.keys, :allow_blanks => true

      def email_address?
        email_address.present?
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xeroizer-2.16.1 lib/xeroizer/models/contact.rb
xeroizer-2.16.0 lib/xeroizer/models/contact.rb