Module: Frontapp::Client::Contacts
- Included in:
- Frontapp::Client
- Defined in:
- lib/frontapp/client/contacts.rb
Instance Method Summary collapse
-
#add_contact_handle!(contact_id, params = {}) ⇒ Object
Parameters Name Type Description ——————————- contact_id string Id or alias of the requested contact ——————————-.
-
#add_contact_note!(contact_id, params = {}) ⇒ Object
Parameters Name Type Description ——————————- contact_id string Id or alias of the requested contact ——————————-.
- #contacts(params = {}) ⇒ Object
-
#create_contact!(params = {}) ⇒ Object
Allowed attributes: Name Type Description ——————————————– name string (optional) Contact name description string (optional) Contact description avatar_url string (optional) URL of the contact’s avatar is_spammer boolean (optional) Whether or not the contact is marked as a spammer links array (optional) List of all the links of the contact group_names array (optional) List of all the group names the contact belongs to.
-
#delete_contact!(contact_id) ⇒ Object
Name Type Description ——————————- contact_id string Id or alias of the requested contact ——————————-.
-
#delete_contact_handle!(contact_id, params = {}) ⇒ Object
Parameters Name Type Description ——————————- contact_id string Id or alias of the requested contact ——————————-.
-
#get_contact(contact_id) ⇒ Object
Parameters Name Type Description ——————————- contact_id string Id or alias of the requested contact ——————————-.
-
#get_contact_conversations(contact_id, params = {}) ⇒ Object
Parameters Name Type Description ——————————- contact_id string Id or alias of the requested contact ——————————-.
-
#get_contact_notes(contact_id) ⇒ Object
Parameters Name Type Description ——————————- contact_id string Id or alias of the requested contact ——————————-.
-
#update_contact!(contact_id, params = {}) ⇒ Object
Parameters Name Type Description ——————————- contact_id string Id or alias of the requested contact ——————————-.
Instance Method Details
#add_contact_handle!(contact_id, params = {}) ⇒ Object
Parameters Name Type Description
contact_id string Id or alias of the requested contact
Allowed attributes: Name Type Description
handle string Handle used to reach the contact. Can be an email address, a twitter, handle, a phone number, …source enum Can be ‘twitter’, ’email’ or ‘phone’.
107 108 109 110 |
# File 'lib/frontapp/client/contacts.rb', line 107 def add_contact_handle!(contact_id, params = {}) cleaned = params.permit(:handle, :source) create_without_response("contacts/#{contact_id}/handles", cleaned) end |
#add_contact_note!(contact_id, params = {}) ⇒ Object
Parameters Name Type Description
contact_id string Id or alias of the requested contact
Allowed attributes: Name Type Description
author_id string Id of the teammate creating the note body string Content of the note
151 152 153 154 |
# File 'lib/frontapp/client/contacts.rb', line 151 def add_contact_note!(contact_id, params = {}) cleaned = params.permit(:author_id, :body) create("contacts/#{contact_id}/notes", cleaned) end |
#contacts(params = {}) ⇒ Object
5 6 7 |
# File 'lib/frontapp/client/contacts.rb', line 5 def contacts(params = {}) list("contacts", params) end |
#create_contact!(params = {}) ⇒ Object
Allowed attributes: Name Type Description
name string (optional) Contact name description string (optional) Contact description avatar_url string (optional) URL of the contact’s avatar is_spammer boolean (optional) Whether or not the contact is marked as a spammer links array (optional) List of all the links of the contact group_names array (optional) List of all the group names the contact belongs to. It will automatically create missing groups. handles array List of the contact handles custom_fields object (optional) Custom field attributes for this contact. Leave empty if you do not wish to update the attributes. Not sending existing attributes will automatically remove them.
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/frontapp/client/contacts.rb', line 58 def create_contact!(params = {}) cleaned = params.permit(:name, :description, :avatar_url, :is_spammer, :links, :group_names, :handles, :custom_fields) create("contacts", cleaned) end |
#delete_contact!(contact_id) ⇒ Object
Name Type Description
contact_id string Id or alias of the requested contact
74 75 76 |
# File 'lib/frontapp/client/contacts.rb', line 74 def delete_contact!(contact_id) delete("contacts/#{contact_id}") end |
#delete_contact_handle!(contact_id, params = {}) ⇒ Object
Parameters Name Type Description
contact_id string Id or alias of the requested contact
Allowed attributes: Name Type Description
handle string Handle used to reach the contact. Can be an email address, a twitter, handle, a phone number, …source enum Can be ‘twitter’, ’email’ or ‘phone’. force boolean (optional) Force the deletetion of the contact if the handle is the last one
125 126 127 128 |
# File 'lib/frontapp/client/contacts.rb', line 125 def delete_contact_handle!(contact_id, params = {}) cleaned = params.permit(:handle, :source, :force) delete("contacts/#{contact_id}/handles", cleaned) end |
#get_contact(contact_id) ⇒ Object
Parameters Name Type Description
contact_id string Id or alias of the requested contact
14 15 16 |
# File 'lib/frontapp/client/contacts.rb', line 14 def get_contact(contact_id) get("contacts/#{contact_id}") end |
#get_contact_conversations(contact_id, params = {}) ⇒ Object
Parameters Name Type Description
contact_id string Id or alias of the requested contact
Allowed params: Name Type Description
q object (optional) Search query. q.statuses array (optional) List of the statuses of the conversations you want to list
90 91 92 93 |
# File 'lib/frontapp/client/contacts.rb', line 90 def get_contact_conversations(contact_id, params = {}) cleaned = params.permit({ q: [:statuses] }) list("contacts/#{contact_id}/conversations", cleaned) end |
#get_contact_notes(contact_id) ⇒ Object
Parameters Name Type Description
contact_id string Id or alias of the requested contact
135 136 137 |
# File 'lib/frontapp/client/contacts.rb', line 135 def get_contact_notes(contact_id) list("contacts/#{contact_id}/notes") end |
#update_contact!(contact_id, params = {}) ⇒ Object
Parameters Name Type Description
contact_id string Id or alias of the requested contact
Allowed attributes: Name Type Description
name string (optional) Contact name description string (optional) Contact description avatar_url string (optional) URL of the contact’s avatar is_spammer boolean (optional) Whether or not the contact is marked as a spammer links array (optional) List of all the links of the contact group_names array (optional) List of all the group names the contact belongs to. It will automatically create missing groups. custom_fields object (optional) Custom field attributes for this contact. Leave empty if you do not wish to update the attributes. Not sending existing attributes will automatically remove them.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/frontapp/client/contacts.rb', line 35 def update_contact!(contact_id, params = {}) cleaned = params.permit(:name, :description, :avatar_url, :is_spammer, :links, :group_names, :custom_fields) update("contacts/#{contact_id}", cleaned) end |