Sha256: 9228cb736134dc1530c6d0520f5f3b8c9d5fc09c1076e02d84b91873ccd192bf

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 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        :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
      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

      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

3 entries across 3 versions & 1 rubygems

Version Path
xeroizer-2.15.8 lib/xeroizer/models/contact.rb
xeroizer-2.15.7 lib/xeroizer/models/contact.rb
xeroizer-2.15.6 lib/xeroizer/models/contact.rb