Class: AutotaskRuby::ServiceCall

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

Overview

Represents the Autotask Entity ServiceCall

Constant Summary collapse

FIELDS =
%i[id AccountID StartDateTime EndDateTime Description Complete CreateDateTime LastModifiedDateTime Duration Status].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, #post_initialize, #to_bool, #to_date_time, #update

Methods included from Association

#belongs_to, #has_many, #has_one

Instance Method Details

#accountObject

Returns the associated Account



32
33
34
# File 'lib/autotask_ruby/service_call.rb', line 32

def 
  find('Account', )
end

#resourceObject

Returns the associated Resource



27
28
29
# File 'lib/autotask_ruby/service_call.rb', line 27

def resource
  find('Resource', resource_id)
end

#resource_idObject

Returns the associated ResourceID.



15
16
17
18
19
20
21
22
23
24
# File 'lib/autotask_ruby/service_call.rb', line 15

def resource_id
  service_call_ticket = find('ServiceCallTicket', 'ServiceCallId', id)

  unless service_call_ticket.nil?
    service_call_ticket_resource = find('ServiceCallTicketResource', 'ServiceCallTicketId', service_call_ticket.id)
    return service_call_ticket_resource.resource_id unless service_call_ticket_resource.nil?
  end

  nil
end

#ticketObject



36
37
38
39
40
41
# File 'lib/autotask_ruby/service_call.rb', line 36

def ticket
  service_call_ticket = find('ServiceCallTicket', 'ServiceCallId', id)
  return find('Ticket', 'id', service_call_ticket.ticket_id) unless service_call_ticket.nil?

  nil
end