Class: RubyRedtail::Contact
- Inherits:
-
Object
- Object
- RubyRedtail::Contact
- Defined in:
- lib/ruby-redtail/contact.rb,
lib/ruby-redtail/contact/accounts.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Accounts
Instance Attribute Summary collapse
-
#api_hash ⇒ Object
Returns the value of attribute api_hash.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #accounts ⇒ Object
- #activities ⇒ Object
- #addresses ⇒ Object
-
#create_user_defined_field(params) ⇒ Object
Create User Defined Field for Contact.
-
#delete ⇒ Object
Delete Contact.
-
#departments ⇒ Object
Fetch Contact Departments.
-
#details ⇒ Object
Fetch Contact Details.
-
#family ⇒ Object
Fetch Contact Family.
-
#fetch(recent = false, basic = false) ⇒ Object
Fetch Contact By Contact Id Optional parameter: ?recent=recent* * 0 does nothing * 1 updates recently viewed.
-
#fetch_basic(recent = false, basic = false) ⇒ Object
Fetch Basic Contact By Contact Id Optional parameter: ?recent=recent* * 0 does nothing * 1 updates recently viewed.
-
#fetch_master ⇒ Object
Master Fetch Contact help.redtailtechnology.com/entries/22846682-master-fetch-contacts-contactid-master.
- #initialize(contact = {}, api_hash) ⇒ Contact constructor
-
#inportant_information ⇒ Object
Fetch Contact Important Information.
-
#memberships ⇒ Object
Fetch Contact Memberships.
- #notes ⇒ Object
-
#personal_profile ⇒ Object
Fetch Contact Personal Profile.
- #tag_groups ⇒ Object
-
#update(params) ⇒ Object
Update Contact.
-
#update_details(params) ⇒ Object
Update Contact Details Is this required? (Deprecated on API website).
-
#update_important_information(params) ⇒ Object
Update Contact Important Information.
-
#update_personal_profile(personal_profile_id, params) ⇒ Object
Update Contact Personal Profile.
-
#update_user_defined_field(udf_id, params) ⇒ Object
Update User Defined Field for Contact.
-
#user_defined_fields ⇒ Object
Fetch User Defined Fields for Contact.
Constructor Details
#initialize(contact = {}, api_hash) ⇒ Contact
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ruby-redtail/contact.rb', line 6 def initialize(contact = {}, api_hash) @api_hash = api_hash raise ArgumentError unless contact['ContactID'] @id = contact['ContactID'] raise ArgumentError if contact.class != Hash contact.each do |key, value| key = key.underscore self.class.send :attr_accessor, key instance_variable_set "@#{key}", value end end |
Instance Attribute Details
#api_hash ⇒ Object
Returns the value of attribute api_hash.
3 4 5 |
# File 'lib/ruby-redtail/contact.rb', line 3 def api_hash @api_hash end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/ruby-redtail/contact.rb', line 3 def id @id end |
Instance Method Details
#accounts ⇒ Object
29 30 31 |
# File 'lib/ruby-redtail/contact.rb', line 29 def accounts RubyRedtail::Contact::Accounts.new self.api_hash end |
#activities ⇒ Object
33 34 35 |
# File 'lib/ruby-redtail/contact.rb', line 33 def activities RubyRedtail::Contact::Activities.new self.api_hash end |
#addresses ⇒ Object
21 22 23 |
# File 'lib/ruby-redtail/contact.rb', line 21 def addresses RubyRedtail::Contact::Addresses.new self.api_hash end |
#create_user_defined_field(params) ⇒ Object
Create User Defined Field for Contact
130 131 132 |
# File 'lib/ruby-redtail/contact.rb', line 130 def create_user_defined_field (params) update_user_defined_field(self.id, 0, params) end |
#delete ⇒ Object
Delete Contact
69 70 71 |
# File 'lib/ruby-redtail/contact.rb', line 69 def delete RubyRedtail::Query.run("contacts/#{self.id}", @api_hash, 'DELETE')['Status'] == 0 end |
#departments ⇒ Object
Fetch Contact Departments
115 116 117 |
# File 'lib/ruby-redtail/contact.rb', line 115 def departments RubyRedtail::Query.run("contacts/#{self.id}/importantinfo", @api_hash, "GET") end |
#details ⇒ Object
Fetch Contact Details
74 75 76 |
# File 'lib/ruby-redtail/contact.rb', line 74 def details RubyRedtail::Query.run("contacts/#{self.id}/details", @api_hash, "GET") end |
#family ⇒ Object
Fetch Contact Family
85 86 87 |
# File 'lib/ruby-redtail/contact.rb', line 85 def family RubyRedtail::Query.run("contacts/#{self.id}/family", @api_hash, "GET") end |
#fetch(recent = false, basic = false) ⇒ Object
Fetch Contact By Contact Id Optional parameter: ?recent=recent*
-
0 does nothing
-
1 updates recently viewed
45 46 47 |
# File 'lib/ruby-redtail/contact.rb', line 45 def fetch (recent = false, basic = false) RubyRedtail::Query.run("contacts/#{self.id}?recent=#{recent ? 1 : 0}", @api_hash, "GET") end |
#fetch_basic(recent = false, basic = false) ⇒ Object
Fetch Basic Contact By Contact Id Optional parameter: ?recent=recent*
-
0 does nothing
-
1 updates recently viewed
53 54 55 |
# File 'lib/ruby-redtail/contact.rb', line 53 def fetch_basic (recent = false, basic = false) RubyRedtail::Query.run("contacts/#{self.id}/basic?recent=#{recent ? 1 : 0}", @api_hash, "GET") end |
#fetch_master ⇒ Object
Master Fetch Contact help.redtailtechnology.com/entries/22846682-master-fetch-contacts-contactid-master
59 60 61 |
# File 'lib/ruby-redtail/contact.rb', line 59 def fetch_master RubyRedtail::Query.run("contacts/#{self.id}/master", @api_hash, 'GET') end |
#inportant_information ⇒ Object
Fetch Contact Important Information
105 106 107 |
# File 'lib/ruby-redtail/contact.rb', line 105 def inportant_information RubyRedtail::Query.run("contacts/#{self.id}/importantinfo", @api_hash, "GET") end |
#memberships ⇒ Object
Fetch Contact Memberships
90 91 92 |
# File 'lib/ruby-redtail/contact.rb', line 90 def memberships RubyRedtail::Query.run("contacts/#{self.id}/memberships", @api_hash, "GET") end |
#notes ⇒ Object
25 26 27 |
# File 'lib/ruby-redtail/contact.rb', line 25 def notes RubyRedtail::Contact::Notes.new self.api_hash end |
#personal_profile ⇒ Object
Fetch Contact Personal Profile
95 96 97 |
# File 'lib/ruby-redtail/contact.rb', line 95 def personal_profile RubyRedtail::Query.run("contacts/#{self.id}/personalprofile", @api_hash, "GET") end |
#tag_groups ⇒ Object
37 38 39 |
# File 'lib/ruby-redtail/contact.rb', line 37 def tag_groups RubyRedtail::Contact::TagGroups.new self.api_hash end |
#update(params) ⇒ Object
Update Contact
64 65 66 |
# File 'lib/ruby-redtail/contact.rb', line 64 def update (params) RubyRedtail::Query.run("contacts/#{self.id}", @api_hash, 'PUT', params) end |
#update_details(params) ⇒ Object
Update Contact Details Is this required? (Deprecated on API website). Ask Client?
80 81 82 |
# File 'lib/ruby-redtail/contact.rb', line 80 def update_details (params) RubyRedtail::Query.run("contacts/#{self.id}/details", @api_hash, 'PUT', params) end |
#update_important_information(params) ⇒ Object
Update Contact Important Information
110 111 112 |
# File 'lib/ruby-redtail/contact.rb', line 110 def update_important_information (params) RubyRedtail::Query.run("contacts/#{self.id}/importantinfo", @api_hash, 'PUT', params) end |
#update_personal_profile(personal_profile_id, params) ⇒ Object
Update Contact Personal Profile
100 101 102 |
# File 'lib/ruby-redtail/contact.rb', line 100 def update_personal_profile (personal_profile_id, params) RubyRedtail::Query.run("contacts/#{self.id}/personalprofile/#{personal_profile_id}", @api_hash, 'PUT', params) end |
#update_user_defined_field(udf_id, params) ⇒ Object
Update User Defined Field for Contact
125 126 127 |
# File 'lib/ruby-redtail/contact.rb', line 125 def update_user_defined_field (udf_id, params) RubyRedtail::Query.run("contacts/#{self.id}/udf/#{udf_id}", @api_hash, 'PUT', params) end |
#user_defined_fields ⇒ Object
Fetch User Defined Fields for Contact
120 121 122 |
# File 'lib/ruby-redtail/contact.rb', line 120 def user_defined_fields RubyRedtail::Query.run("contacts/#{self.id}/udf", @api_hash, "GET") end |