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: Account
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
-
#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.
-
#personal_profile ⇒ Object
Fetch Contact Personal Profile.
-
#tag_groups ⇒ Object
def addresses RubyRedtail::Contact::Addresses.new @api_hash end.
-
#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
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ruby-redtail/contact.rb', line 12 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.
9 10 11 |
# File 'lib/ruby-redtail/contact.rb', line 9 def api_hash @api_hash end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/ruby-redtail/contact.rb', line 9 def id @id end |
Instance Method Details
#create_user_defined_field(params) ⇒ Object
Create User Defined Field for Contact
136 137 138 |
# File 'lib/ruby-redtail/contact.rb', line 136 def create_user_defined_field (params) update_user_defined_field(@id, 0, params) end |
#delete ⇒ Object
Delete Contact
75 76 77 |
# File 'lib/ruby-redtail/contact.rb', line 75 def delete RubyRedtail::Query.run("contacts/#{@id}", @api_hash, 'DELETE')['Status'] == 0 end |
#departments ⇒ Object
Fetch Contact Departments
121 122 123 |
# File 'lib/ruby-redtail/contact.rb', line 121 def departments RubyRedtail::Query.run("contacts/#{@id}/importantinfo", @api_hash, "GET") end |
#details ⇒ Object
Fetch Contact Details
80 81 82 |
# File 'lib/ruby-redtail/contact.rb', line 80 def details RubyRedtail::Query.run("contacts/#{@id}/details", @api_hash, "GET") end |
#family ⇒ Object
Fetch Contact Family
91 92 93 |
# File 'lib/ruby-redtail/contact.rb', line 91 def family RubyRedtail::Query.run("contacts/#{@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
51 52 53 |
# File 'lib/ruby-redtail/contact.rb', line 51 def fetch (recent = false, basic = false) RubyRedtail::Query.run("contacts/#{@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
59 60 61 |
# File 'lib/ruby-redtail/contact.rb', line 59 def fetch_basic (recent = false, basic = false) RubyRedtail::Query.run("contacts/#{@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
65 66 67 |
# File 'lib/ruby-redtail/contact.rb', line 65 def fetch_master RubyRedtail::Query.run("contacts/#{@id}/master", @api_hash, 'GET') end |
#inportant_information ⇒ Object
Fetch Contact Important Information
111 112 113 |
# File 'lib/ruby-redtail/contact.rb', line 111 def inportant_information RubyRedtail::Query.run("contacts/#{@id}/importantinfo", @api_hash, "GET") end |
#memberships ⇒ Object
Fetch Contact Memberships
96 97 98 |
# File 'lib/ruby-redtail/contact.rb', line 96 def memberships RubyRedtail::Query.run("contacts/#{@id}/memberships", @api_hash, "GET") end |
#personal_profile ⇒ Object
Fetch Contact Personal Profile
101 102 103 |
# File 'lib/ruby-redtail/contact.rb', line 101 def personal_profile RubyRedtail::Query.run("contacts/#{@id}/personalprofile", @api_hash, "GET") end |
#tag_groups ⇒ Object
def addresses
RubyRedtail::Contact::Addresses.new @api_hash
end
def notes
RubyRedtail::Contact::Notes.new @api_hash
end
def accounts
RubyRedtail::Contact::Accounts.new @api_hash
end
def activities
RubyRedtail::Contact::Activities.new @api_hash
end
43 44 45 |
# File 'lib/ruby-redtail/contact.rb', line 43 def tag_groups build_tag_groups_array RubyRedtail::Query.run("contacts/#{@contact_id}/taggroups", @api_hash, "GET") end |
#update(params) ⇒ Object
Update Contact
70 71 72 |
# File 'lib/ruby-redtail/contact.rb', line 70 def update (params) RubyRedtail::Query.run("contacts/#{@id}", @api_hash, 'PUT', params) end |
#update_details(params) ⇒ Object
Update Contact Details Is this required? (Deprecated on API website). Ask Client?
86 87 88 |
# File 'lib/ruby-redtail/contact.rb', line 86 def update_details (params) RubyRedtail::Query.run("contacts/#{@id}/details", @api_hash, 'PUT', params) end |
#update_important_information(params) ⇒ Object
Update Contact Important Information
116 117 118 |
# File 'lib/ruby-redtail/contact.rb', line 116 def update_important_information (params) RubyRedtail::Query.run("contacts/#{@id}/importantinfo", @api_hash, 'PUT', params) end |
#update_personal_profile(personal_profile_id, params) ⇒ Object
Update Contact Personal Profile
106 107 108 |
# File 'lib/ruby-redtail/contact.rb', line 106 def update_personal_profile (personal_profile_id, params) RubyRedtail::Query.run("contacts/#{@id}/personalprofile/#{personal_profile_id}", @api_hash, 'PUT', params) end |
#update_user_defined_field(udf_id, params) ⇒ Object
Update User Defined Field for Contact
131 132 133 |
# File 'lib/ruby-redtail/contact.rb', line 131 def update_user_defined_field (udf_id, params) RubyRedtail::Query.run("contacts/#{@id}/udf/#{udf_id}", @api_hash, 'PUT', params) end |
#user_defined_fields ⇒ Object
Fetch User Defined Fields for Contact
126 127 128 |
# File 'lib/ruby-redtail/contact.rb', line 126 def user_defined_fields RubyRedtail::Query.run("contacts/#{@id}/udf", @api_hash, "GET") end |