Class: AutotaskAPI::Resource

Inherits:
Entity
  • Object
show all
Defined in:
lib/autotask_api/resource.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

.find_by_email(email) ⇒ Object


5
6
7
8
9
10
11
12
# File 'lib/autotask_api/resource.rb', line 5

def self.find_by_email(email)
  query = AutotaskAPI::QueryXML.new do |query|
    query.entity = self.to_s.demodulize
    query.field = 'email'
    query.expression = email
  end
  client.entities_for(query).first
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/autotask_api/resource.rb', line 22

def active?
  active.to_s == 'true'
end

#firstname_lastname_initialObject


18
19
20
# File 'lib/autotask_api/resource.rb', line 18

def firstname_lastname_initial
  "#{first_name} #{last_name[0]}."
end

#full_nameObject


14
15
16
# File 'lib/autotask_api/resource.rb', line 14

def full_name
  [ first_name, last_name ].join(' ')
end