Class: RDStation::Contacts
- Inherits:
-
Object
- Object
- RDStation::Contacts
- Includes:
- HTTParty
- Defined in:
- lib/rdstation/contacts.rb
Overview
Instance Method Summary collapse
- #by_email(email) ⇒ Object
-
#by_uuid(uuid) ⇒ Object
param uuid: The unique uuid associated to each RD Station Contact.
-
#initialize(auth_token) ⇒ Contacts
constructor
A new instance of Contacts.
-
#update(uuid, contact_hash) ⇒ Object
The Contact hash may contain the following parameters: :email :name :job_title :linkedin :facebook :twitter :personal_phone :mobile_phone :website :tags.
-
#upsert(identifier, identifier_value, contact_hash) ⇒ Object
param identifier: Field that will be used to identify the contact.
Constructor Details
#initialize(auth_token) ⇒ Contacts
Returns a new instance of Contacts.
7 8 9 |
# File 'lib/rdstation/contacts.rb', line 7 def initialize(auth_token) @auth_token = auth_token end |
Instance Method Details
#by_email(email) ⇒ Object
20 21 22 23 |
# File 'lib/rdstation/contacts.rb', line 20 def by_email(email) response = self.class.get(base_url("email:#{email}"), headers: required_headers) ApiResponse.build(response) end |
#by_uuid(uuid) ⇒ Object
param uuid:
The unique uuid associated to each RD Station Contact.
15 16 17 18 |
# File 'lib/rdstation/contacts.rb', line 15 def by_uuid(uuid) response = self.class.get(base_url(uuid), headers: required_headers) ApiResponse.build(response) end |
#update(uuid, contact_hash) ⇒ Object
The Contact hash may contain the following parameters: :email :name :job_title :linkedin :facebook :twitter :personal_phone :mobile_phone :website :tags
36 37 38 39 |
# File 'lib/rdstation/contacts.rb', line 36 def update(uuid, contact_hash) response = self.class.patch(base_url(uuid), :body => contact_hash.to_json, :headers => required_headers) ApiResponse.build(response) end |
#upsert(identifier, identifier_value, contact_hash) ⇒ Object
param identifier:
Field that will be used to identify the contact.
param identifier_value:
Value to the identifier given.
param contact_hash:
Contact data
49 50 51 52 53 |
# File 'lib/rdstation/contacts.rb', line 49 def upsert(identifier, identifier_value, contact_hash) path = "#{identifier}:#{identifier_value}" response = self.class.patch(base_url(path), body: contact_hash.to_json, headers: required_headers) ApiResponse.build(response) end |