Class: EasyHubspot::Contact
Overview
class EasyHubspot::Contact
Constant Summary collapse
- CONTACT_ENDPOINT =
'crm/v3/objects/contacts'
Class Method Summary collapse
- .create_contact(body) ⇒ Object
- .delete_contact(contact_id) ⇒ Object
- .get_contact(contact_id) ⇒ Object
- .get_contacts ⇒ Object
- .update_contact(contact_id, body) ⇒ Object
- .update_or_create_contact(email, body) ⇒ Object
Methods inherited from Base
Class Method Details
.create_contact(body) ⇒ Object
17 18 19 |
# File 'lib/easy_hubspot/contact.rb', line 17 def create_contact(body) Client.do_post(CONTACT_ENDPOINT, body, headers) end |
.delete_contact(contact_id) ⇒ Object
25 26 27 |
# File 'lib/easy_hubspot/contact.rb', line 25 def delete_contact(contact_id) Client.do_delete(determine_endpoint(contact_id), headers) end |
.get_contact(contact_id) ⇒ Object
9 10 11 |
# File 'lib/easy_hubspot/contact.rb', line 9 def get_contact(contact_id) Client.do_get(determine_endpoint(contact_id), headers) end |
.get_contacts ⇒ Object
13 14 15 |
# File 'lib/easy_hubspot/contact.rb', line 13 def get_contacts Client.do_get(CONTACT_ENDPOINT, headers) end |
.update_contact(contact_id, body) ⇒ Object
21 22 23 |
# File 'lib/easy_hubspot/contact.rb', line 21 def update_contact(contact_id, body) Client.do_patch(determine_endpoint(contact_id), body, headers) end |
.update_or_create_contact(email, body) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/easy_hubspot/contact.rb', line 29 def update_or_create_contact(email, body) res = get_contact(email) if res && res[:id] update_contact(email, body) else create_contact(body) end end |