Class: AutotaskRuby::Resource

Inherits:
Object
  • Object
show all
Includes:
Entity, Query
Defined in:
lib/autotask_ruby/resource.rb

Overview

Represents the Autotask Entity Resource

Constant Summary collapse

FIELDS =
%i[id Email Email2 Email3 FirstName HomePhone Initials LastName LocationID MiddleName
            MobilePhone OfficeExtension OfficePhone ResourceType Title UserName UserType Active].freeze
         .each do |field|
  attr_accessor :"#{field.to_s.underscore}"
end

Constants included from Constants

Constants::AUTOTASK_TIME_FORMAT

Instance Method Summary collapse

Methods included from Query

#find, #query

Methods included from Entity

#build, #create, #field_set, #fields_to_xml, #format_field_to_xml, included, #initialize, #to_bool, #to_date_time, #update

Methods included from Association

#belongs_to, #has_many, #has_one

Instance Method Details

#post_initializeObject



15
16
17
18
19
20
# File 'lib/autotask_ruby/resource.rb', line 15

def post_initialize
  has_many :account_to_dos, foreign_key: 'AssignedToResourceID'
  has_many :appointments, foreign_key: 'ResourceID'
  has_many :tickets, foreign_key: 'AssignedResourceID'
  has_many :tasks, foreign_key: 'AssignedResourceID'
end