Class: Highrise::Person
Constant Summary
collapse
- DATE_OCCASIONS =
["Birthday", "Anniversary", "First met", "Hired", "Fired"]
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Taggable
#get_document, #tag!, #tags, #untag!, #untag_id!
Methods included from Pagination
included
Methods inherited from Subject
#add_deal!, #add_note!, #add_task!, #emails, #notes, #upcoming_tasks
Class Method Details
.find_all_across_pages_since(time) ⇒ Object
17
18
19
|
# File 'lib/highrise/person.rb', line 17
def self.find_all_across_pages_since(time)
find_all_across_pages(:params => { :since => time.utc.to_s(:db).gsub(/[^\d]/, '') })
end
|
.find_all_by_tag(tag_name) ⇒ Object
12
13
14
15
|
# File 'lib/highrise/person.rb', line 12
def self.find_all_by_tag(tag_name)
tag = Tag.find_by_name(tag_name)
find(:all, :from => "/tags/#{tag.id}.xml")
end
|
.search_by_name(name) ⇒ Object
8
9
10
|
# File 'lib/highrise/person.rb', line 8
def self.search_by_name(name)
find(:first, :from => "/people/search.xml", :params => {:term => name})
end
|
Instance Method Details
#add_date!(description, date, task_owner_id = nil) ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/highrise/person.rb', line 30
def add_date!(description, date, task_owner_id=nil)
description_key = DATE_OCCASIONS.include?(description) ? :description : :custom_description
custom_date = { description_key => description, :month => date.month, :day => date.day, :year => date.year }
if task_owner_id
custom_date[:assign_task] = true
custom_date[:task_owner_id] = task_owner_id
end
self.post(:contact_dates, :contact_date => custom_date) rescue nil
end
|
#company ⇒ Object
21
22
23
|
# File 'lib/highrise/person.rb', line 21
def company
Company.find(company_id) if company_id
end
|
#name ⇒ Object
25
26
27
|
# File 'lib/highrise/person.rb', line 25
def name
"#{first_name rescue ''} #{last_name rescue ''}".strip
end
|