Module: Contacts
- Included in:
- CRM, Mints::User
- Defined in:
- lib/user/crm/contacts.rb,
lib/user/contacts/contacts.rb
Instance Method Summary collapse
-
#change_password_no_auth(data) ⇒ Object
Contact Auth.
-
#create_contact(data, options = nil) ⇒ Object
Create contact.
-
#create_contact_deal(contact_id, data) ⇒ Object
Create contact deal.
-
#create_contact_user(contact_id, data) ⇒ Object
Create contact user.
-
#delete_contact_deal(contact_id, deal_id) ⇒ Object
Delete contact deal.
-
#delete_contact_user(contact_id, id) ⇒ Object
Delete contact user.
-
#delete_contacts(data) ⇒ Object
Delete contacts.
-
#get_contact(id, options = nil) ⇒ Object
Get contact.
-
#get_contact_deal(contact_id) ⇒ Object
Get contact deals.
-
#get_contact_magic_links(contact_id) ⇒ Object
Get contact magic links.
-
#get_contact_segments(contact_id) ⇒ Object
Get contact segments.
-
#get_contact_submissions(contact_id) ⇒ Object
Get contact submissions.
-
#get_contact_tags(contact_id) ⇒ Object
Get contact tags.
-
#get_contact_user(contact_id) ⇒ Object
Get contact user.
-
#get_contacts(options = nil, use_post = true) ⇒ Object
Get contacts.
-
#get_contacts_support_data ⇒ Object
Get contacts support data.
-
#get_online_activity(id) ⇒ Object
Get online activity.
-
#merge_contacts(id, data) ⇒ Object
Create contact merge.
-
#send_magic_links(data) ⇒ Object
Send magic links.
-
#update_contact(id, data, options = nil) ⇒ Object
Update contact.
Instance Method Details
#change_password_no_auth(data) ⇒ Object
Contact Auth
Change password no auth.
Change password to an email without auth.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
password: '12345678',
email: '[email protected]'
}
@data = @mints_user.change_password_no_auth(data)
17 18 19 |
# File 'lib/user/contacts/contacts.rb', line 17 def change_password_no_auth(data) @client.raw('post', '/contacts/change-password-no-auth', nil, data_transform(data)) end |
#create_contact(data, options = nil) ⇒ Object
Create contact.
Create a contact with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
email: '[email protected]',
given_name: 'Given Name',
last_name: 'Last Name',
password: '123456'
}
@data = @mints_user.create_contact(data)
92 93 94 |
# File 'lib/user/crm/contacts.rb', line 92 def create_contact(data, = nil) @client.raw('post', '/crm/contacts', , data_transform(data)) end |
#create_contact_deal(contact_id, data) ⇒ Object
Create contact deal.
Create a contact deal with data.
Parameters
- contact_id
-
(Integer) – Contact id.
- data
-
(Hash) – Data to be submitted.
Example
data = { deal_id: 6 }
@data = @mints_user.create_contact_deal(5, data.to_json)
138 139 140 |
# File 'lib/user/crm/contacts.rb', line 138 def create_contact_deal(contact_id, data) @client.raw('post', "/crm/contacts/#{contact_id}/deals", nil, data) end |
#create_contact_user(contact_id, data) ⇒ Object
Create contact user.
Relate a contact with an user.
Parameters
- contact_id
-
(Integer) – Contact id.
- data
-
(Hash) – Data to be submitted.
Example
data = { user_id: 9 }
@data = @mints_user.create_contact_user(66, data.to_json)
182 183 184 |
# File 'lib/user/crm/contacts.rb', line 182 def create_contact_user(contact_id, data) @client.raw('post', "/crm/contacts/#{contact_id}/users", nil, data) end |
#delete_contact_deal(contact_id, deal_id) ⇒ Object
Delete contact deal.
Delete a contact deal with data.
Parameters
- contact_id
-
(Integer) – Contact id.
- deal_id
-
(Integer) – Deal id.
Example
@data = @mints_user.delete_contact_deal(5, 100)
152 153 154 |
# File 'lib/user/crm/contacts.rb', line 152 def delete_contact_deal(contact_id, deal_id) @client.raw('delete', "/crm/contacts/#{contact_id}/deals/#{deal_id}") end |
#delete_contact_user(contact_id, id) ⇒ Object
Delete contact user.
Delete a relationship between a contact and an user.
Parameters
- contact_id
-
(Integer) – Contact id.
- id
-
(Integer) – User id.
Example
@data = @mints_user.delete_contact_user(153, 9)
196 197 198 |
# File 'lib/user/crm/contacts.rb', line 196 def delete_contact_user(contact_id, id) @client.raw('delete', "/crm/contacts/#{contact_id}/users/#{id}") end |
#delete_contacts(data) ⇒ Object
Delete contacts.
Delete different contacts.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = { ids": %w[67 68 69] }
@data = @mints_user.delete_contacts(data)
301 302 303 304 |
# File 'lib/user/crm/contacts.rb', line 301 def delete_contacts(data) # TODO: ContactController.delete need a success output @client.raw('delete', '/crm/contacts/delete', nil, data_transform(data)) end |
#get_contact(id, options = nil) ⇒ Object
Get contact.
Get a contact data.
Parameters
- id
-
(Integer) – Contact id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @mints_user.get_contact(5)
Second Example
= {
sort: 'id',
'fields[contacts]': 'id, email'
}
@data = @mints_user.get_contact(5, )
73 74 75 |
# File 'lib/user/crm/contacts.rb', line 73 def get_contact(id, = nil) @client.raw('get', "/crm/contacts/#{id}", ) end |
#get_contact_deal(contact_id) ⇒ Object
Get contact deals.
Get a collection of deals of a contact.
Parameters
- contact_id
-
(Integer) – Contact id.
Example
@data = @mints_user.get_contact_deal(5)
123 124 125 |
# File 'lib/user/crm/contacts.rb', line 123 def get_contact_deal(contact_id) @client.raw('get', "/crm/contacts/#{contact_id}/deals") end |
#get_contact_magic_links(contact_id) ⇒ Object
Get contact magic links.
Get magic links of a contact.
Parameters
- contact_id
-
(Integer) – Contact id.
Example
@data = @mints_user.get_contact_magic_links(150)
248 249 250 |
# File 'lib/user/crm/contacts.rb', line 248 def get_contact_magic_links(contact_id) @client.raw('get', "/crm/contacts/#{contact_id}/magic-links") end |
#get_contact_segments(contact_id) ⇒ Object
Get contact segments.
Get segments of a contact.
Parameters
- contact_id
-
(Integer) – Contact id.
Example
@data = @mints_user.get_contact_segments(1)
209 210 211 |
# File 'lib/user/crm/contacts.rb', line 209 def get_contact_segments(contact_id) @client.raw('get', "/crm/contacts/#{contact_id}/segments") end |
#get_contact_submissions(contact_id) ⇒ Object
Get contact submissions.
Get submissions of a contact.
Parameters
- contact_id
-
(Integer) – Contact id.
Example
@data = @mints_user.get_contact_submissions(146)
222 223 224 |
# File 'lib/user/crm/contacts.rb', line 222 def get_contact_submissions(contact_id) @client.raw('get', "/crm/contacts/#{contact_id}/submissions") end |
#get_contact_tags(contact_id) ⇒ Object
Get contact tags.
Get tags of a contact.
Parameters
- contact_id
-
(Integer) – Contact id.
Example
@data = @mints_user.(1)
235 236 237 |
# File 'lib/user/crm/contacts.rb', line 235 def (contact_id) @client.raw('get', "/crm/contacts/#{contact_id}/tags") end |
#get_contact_user(contact_id) ⇒ Object
Get contact user.
Get user data of a contact.
Parameters
TODO: Replace Resource collection options url
- contact_id
-
(Integer) – Contact id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
Example
@data = @mints_user.get_contact_user(66)
167 168 169 |
# File 'lib/user/crm/contacts.rb', line 167 def get_contact_user(contact_id) @client.raw('get', "/crm/contacts/#{contact_id}/users") end |
#get_contacts(options = nil, use_post = true) ⇒ Object
Get contacts.
Get a collection of contacts.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
- use_post
-
(Boolean) – Variable to determine if the request is by ‘post’ or ‘get’ functions.
First Example
@data = @mints_user.get_contacts
Second Example
= {
sort: 'id',
'fields[contacts]': 'id, email'
}
@data = @mints_user.get_contacts()
Third Example
= {
sort: 'id',
'fields[contacts]': 'id, email'
}
@data = @mints_user.get_contacts(, true)
52 53 54 |
# File 'lib/user/crm/contacts.rb', line 52 def get_contacts( = nil, use_post = true) get_query_results('/crm/contacts', , use_post) end |
#get_contacts_support_data ⇒ Object
Get contacts support data.
Example
@data = @mints_user.get_contacts_support_data
11 12 13 |
# File 'lib/user/crm/contacts.rb', line 11 def get_contacts_support_data @client.raw('get', '/crm/contacts/support-data') end |
#get_online_activity(id) ⇒ Object
Get online activity.
Get online activity of a contact.
Parameters
- id
-
(Integer) – Contact id.
Example
@data = @mints_user.get_online_activity(5)
24 25 26 |
# File 'lib/user/crm/contacts.rb', line 24 def get_online_activity(id) @client.raw('get', "/crm/contacts/#{id}/online-activity") end |
#merge_contacts(id, data) ⇒ Object
Create contact merge.
Merge contacts.
Parameters
- id
-
(Integer) – Contact id.
- data
-
(Hash) – Data to be submitted. It contains ids to be merged.
Example
data = { mergeContactIds: [152] }
@data = @mints_user.merge_contacts(151, data)
263 264 265 |
# File 'lib/user/crm/contacts.rb', line 263 def merge_contacts(id, data) @client.raw('post', "/crm/contacts/#{id}/merge", nil, data_transform(data)) end |
#send_magic_links(data) ⇒ Object
Send magic links.
Send magic links to contacts.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
contacts: %w[[email protected] [email protected] [email protected]],
templateId: 2,
redirectUrl: "",
lifeTime: 1440,
maxVisits: 3
}
@data = @mints_user.send_magic_links(data)
283 284 285 |
# File 'lib/user/crm/contacts.rb', line 283 def send_magic_links(data) @client.raw('post', '/crm/contacts/send-magic-link', nil, data_transform(data)) end |
#update_contact(id, data, options = nil) ⇒ Object
Update contact.
Update contact data.
Parameters
- id
-
(Integer) – Contact id.
- data
-
(Hash) – Data to be submitted.
Example
data = {
email: '[email protected]',
company_id: 3
}
@data = @mints_user.update_contact(65, data)
110 111 112 |
# File 'lib/user/crm/contacts.rb', line 110 def update_contact(id, data, = nil) @client.raw('put', "/crm/contacts/#{id}", , data_transform(data)) end |