Class: CapsuleCRM::Party
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
- .find_all_by_email(email, options = {}) ⇒ Object
-
.find_by_email(email) ⇒ Object
nodoc.
-
.get_path ⇒ Object
nodoc.
-
.search(query, options = {}) ⇒ Object
nodoc.
Instance Method Summary collapse
-
#addresses ⇒ Object
nodoc.
-
#custom_fields ⇒ Object
nodoc.
-
#emails ⇒ Object
nodoc.
-
#phone_numbers ⇒ Object
nodoc.
Methods inherited from Base
#==, #errors, find, #initialize, last_response, #new_record?
Constructor Details
This class inherits a constructor from CapsuleCRM::Base
Class Method Details
.find_all_by_email(email, options = {}) ⇒ Object
45 46 47 48 |
# File 'lib/capsulecrm/party.rb', line 45 def self.find_all_by_email(email, ={}) [:email] = email find_all() end |
.find_by_email(email) ⇒ Object
nodoc
52 53 54 |
# File 'lib/capsulecrm/party.rb', line 52 def self.find_by_email(email) find_all_by_email(email, :limit => 1, :offset => 0).first end |
.get_path ⇒ Object
nodoc
40 41 42 |
# File 'lib/capsulecrm/party.rb', line 40 def self.get_path '/api/party' end |
.search(query, options = {}) ⇒ Object
nodoc
58 59 60 61 |
# File 'lib/capsulecrm/party.rb', line 58 def self.search(query, ={}) [:q] = query find_all() end |
Instance Method Details
#addresses ⇒ Object
nodoc
5 6 7 8 9 |
# File 'lib/capsulecrm/party.rb', line 5 def addresses return @addresses if @addresses data = raw_data['contacts']['address'] @addresses = CapsuleCRM::Address.init_many(self, data) end |
#custom_fields ⇒ Object
nodoc
13 14 15 16 17 18 19 20 |
# File 'lib/capsulecrm/party.rb', line 13 def custom_fields return @custom_fields if @custom_fields path = self.class.base_path path = [path, '/', id, '/customfield'].join last_response = self.class.get(path) data = last_response['customFields']['customField'] @custom_fields = CapsuleCRM::CustomField.init_many(self, data) end |
#emails ⇒ Object
nodoc
24 25 26 27 28 |
# File 'lib/capsulecrm/party.rb', line 24 def emails return @emails if @emails data = raw_data['contacts']['email'] @emails = CapsuleCRM::Email.init_many(self, data) end |
#phone_numbers ⇒ Object
nodoc
32 33 34 35 36 |
# File 'lib/capsulecrm/party.rb', line 32 def phone_numbers return @phone_numbers if @phone_numbers data = raw_data['contacts']['phone'] @phone_numbers = CapsuleCRM::Phone.init_many(self, data) end |