Class: CapsuleCRM::Person

Inherits:
Party show all
Defined in:
lib/capsulecrm/person.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#id, #raw_data

Instance Method Summary collapse

Methods inherited from Party

#addresses, #custom_fields, #emails, find_all_by_email, find_by_email, get_path, #is?, #phone_numbers, search, #tag, #tag_names, #tags, #untag, #websites

Methods included from History

#add_history, #history, #history!

Methods inherited from Base

#==, #errors, find, #initialize, last_response, #new_record?

Constructor Details

This class inherits a constructor from CapsuleCRM::Base

Instance Attribute Details

#aboutObject

Returns the value of attribute about.



3
4
5
# File 'lib/capsulecrm/person.rb', line 3

def about
  @about
end

#first_nameObject

Returns the value of attribute first_name.



4
5
6
# File 'lib/capsulecrm/person.rb', line 4

def first_name
  @first_name
end

#job_titleObject

Returns the value of attribute job_title.



5
6
7
# File 'lib/capsulecrm/person.rb', line 5

def job_title
  @job_title
end

#last_nameObject

Returns the value of attribute last_name.



6
7
8
# File 'lib/capsulecrm/person.rb', line 6

def last_name
  @last_name
end

#noteObject

Returns the value of attribute note.



9
10
11
# File 'lib/capsulecrm/person.rb', line 9

def note
  @note
end

#organisation_idObject

Returns the value of attribute organisation_id.



7
8
9
# File 'lib/capsulecrm/person.rb', line 7

def organisation_id
  @organisation_id
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#attributesObject

nodoc



15
16
17
18
19
20
21
22
# File 'lib/capsulecrm/person.rb', line 15

def attributes
  attrs = {}
  arr = [:about, :first_name, :last_name, :title, :job_title]
  arr.each do |key|
    attrs[key] = self.send(key)
  end
  attrs
end

#organisationObject

nodoc



47
48
49
50
# File 'lib/capsulecrm/person.rb', line 47

def organisation
  return nil if organisation_id.nil?
  @organisation ||= CapsuleCRM::Organisation.find(organisation_id)
end

#saveObject

nodoc



54
55
56
# File 'lib/capsulecrm/person.rb', line 54

def save
  new_record?? create : update
end