Class: RDStation::Contacts

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/rdstation/contacts.rb

Overview

Instance Method Summary collapse

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

#get_contact(uuid) ⇒ Object

param uuid:

The unique uuid associated to each RD Station Contact.


15
16
17
# File 'lib/rdstation/contacts.rb', line 15

def get_contact(uuid)
  self.class.get(base_url(uuid), :headers => required_headers)
end

#get_contact_by_email(email) ⇒ Object



19
20
21
# File 'lib/rdstation/contacts.rb', line 19

def get_contact_by_email(email)
  self.class.get(base_url("email:#{email}"), :headers => required_headers)
end

#update_contact(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



34
35
36
# File 'lib/rdstation/contacts.rb', line 34

def update_contact(uuid, contact_hash)
  self.class.patch(base_url(uuid), :body => contact_hash.to_json, :headers => required_headers)
end

#upsert_contact(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


46
47
48
49
# File 'lib/rdstation/contacts.rb', line 46

def upsert_contact(identifier, identifier_value, contact_hash)
  path = "#{identifier}:#{identifier_value}"
  self.class.patch(base_url(path), :body => contact_hash.to_json, :headers => required_headers)
end