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
Change password no 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
Change password no auth.
Change password to an email without auth.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"password": "12345678",
"email": "email@example.com"
}
@data = @mints_user.change_password_no_auth(data)
18 19 20 |
# File 'lib/user/contacts/contacts.rb', line 18 def change_password_no_auth(data) return @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@example.com",
"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) return @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)
140 141 142 |
# File 'lib/user/crm/contacts.rb', line 140 def create_contact_deal(contact_id, data) return @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)
186 187 188 |
# File 'lib/user/crm/contacts.rb', line 186 def create_contact_user(contact_id, data) return @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)
154 155 156 |
# File 'lib/user/crm/contacts.rb', line 154 def delete_contact_deal(contact_id, deal_id) return @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)
200 201 202 |
# File 'lib/user/crm/contacts.rb', line 200 def delete_contact_user(contact_id, id) return @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": [ 67, 68, 69 ]
}
@data = @mints_user.delete_contacts(data)
309 310 311 |
# File 'lib/user/crm/contacts.rb', line 309 def delete_contacts(data) #TODO: ContactController.delete need a success output return @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) return @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) return @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)
252 253 254 |
# File 'lib/user/crm/contacts.rb', line 252 def get_contact_magic_links(contact_id) return @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)
213 214 215 |
# File 'lib/user/crm/contacts.rb', line 213 def get_contact_segments(contact_id) return @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)
226 227 228 |
# File 'lib/user/crm/contacts.rb', line 226 def get_contact_submissions(contact_id) return @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)
239 240 241 |
# File 'lib/user/crm/contacts.rb', line 239 def (contact_id) return @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
- contact_id
-
(Integer) – Contact id.
TODO: Replace Resource collection options url
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
Example
@data = @mints_user.get_contact_user(66)
169 170 171 |
# File 'lib/user/crm/contacts.rb', line 169 def get_contact_user(contact_id) return @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) return 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 return @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) return @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)
269 270 271 |
# File 'lib/user/crm/contacts.rb', line 269 def merge_contacts(id, data) return @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": ["email_1@example.com", "email_2@example.com", "email_3@example.com"],
"templateId": 2,
"redirectUrl": "",
"lifeTime": 1440,
"maxVisits": 3
}
@data = @mints_user.send_magic_links(data)
289 290 291 |
# File 'lib/user/crm/contacts.rb', line 289 def send_magic_links(data) return @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_modified@example.com",
"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) return @client.raw("put", "/crm/contacts/#{id}", , data_transform(data)) end |