Class: Highrise::Person

Inherits:
Subject
  • Object
show all
Includes:
HasSubjectData, Pagination, Searchable, Taggable
Defined in:
lib/highrise/person.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasSubjectData

#field, #subject_data_hash

Methods included from Searchable

included

Methods included from Taggable

#tag!, #tags, #untag!

Methods included from Pagination

included

Methods inherited from Subject

#add_note, #add_task, #emails, #notes, #upcoming_tasks

Methods inherited from Base

url_for

Class Method Details

.tagged_with_id(id) ⇒ Object



49
50
51
52
53
# File 'lib/highrise/person.rb', line 49

def self.tagged_with_id id
 find_all_across_pages(:from => "/tags/#{id}.xml").select do |obj|
    obj.kind_of?(Person)
  end
end

.tagged_with_name(tag_name) ⇒ Object



45
46
47
# File 'lib/highrise/person.rb', line 45

def self.tagged_with_name(tag_name)
  tagged_with_id((Tag.find_by_name(tag_name)).id)
end

Instance Method Details

#addressObject



16
17
18
# File 'lib/highrise/person.rb', line 16

def address
  contact_data.addresses.first
end

#companyObject



8
9
10
# File 'lib/highrise/person.rb', line 8

def company
  Company.find(company_id) if company_id
end

#email_addressObject Also known as: email



36
37
38
# File 'lib/highrise/person.rb', line 36

def email_address
  contact_data.email_addresses.first.address rescue nil
end

#email_valid?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/highrise/person.rb', line 32

def email_valid?
  !!(email_address && (email_address =~ RFC822::EmailAddress))
end

#labelObject



24
25
26
# File 'lib/highrise/person.rb', line 24

def label
  'Party'
end

#nameObject



12
13
14
# File 'lib/highrise/person.rb', line 12

def name
  "#{first_name rescue ''} #{last_name rescue ''}".strip
end

#phone_numberObject



28
29
30
# File 'lib/highrise/person.rb', line 28

def phone_number
  contact_data.phone_numbers.first.number rescue nil
end

#tagged?(name) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/highrise/person.rb', line 41

def tagged? name
 tags.any?{ | tag | tag['name'].to_s == name}  
end

#web_addressObject



20
21
22
# File 'lib/highrise/person.rb', line 20

def web_address
  contact_data.web_addresses.first
end