Class: AutotaskAPI::Ticket

Inherits:
Entity
  • Object
show all
Defined in:
lib/autotask_api/ticket.rb

Instance Attribute Summary

Attributes inherited from Entity

#attributes, #raw_xml

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

belongs_to, find, has_one, #initialize, #method_missing

Constructor Details

This class inherits a constructor from AutotaskAPI::Entity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AutotaskAPI::Entity

Class Method Details

.status_mapObject


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/autotask_api/ticket.rb', line 14

def self.status_map
  @status_map ||= client.field_info(self.to_s.demodulize).
    xpath('//AT:Field/AT:Name[text()="Status"]/..//AT:PickListValue',
         AT: Client::NAMESPACE).
         inject({}) do |memo, node|
    value, label = node.xpath('(AT:Value | AT:Label)/text()',
                             AT: Client::NAMESPACE).collect(&:to_s)
    memo[value] = label
    memo
  end
end

Instance Method Details

#assigned_resourceObject


5
6
7
8
# File 'lib/autotask_api/ticket.rb', line 5

def assigned_resource
  return if assigned_resource_id.blank?
  Resource.find(assigned_resource_id)
end

#status_nameObject


10
11
12
# File 'lib/autotask_api/ticket.rb', line 10

def status_name
  self.class.status_map[status]
end