Module: Contacts

Included in:
CRM, Mints::User
Defined in:
lib/user/crm/contacts.rb,
lib/user/contacts/contacts.rb
more...

Instance Method Summary collapse

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@example.com'
}
@data = @mints_user.change_password_no_auth(data)
[View source]

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

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@example.com',
  given_name: 'Given Name',
  last_name: 'Last Name',
  password: '123456'
}
@data = @mints_user.create_contact(data)
[View source]

94
95
96
# File 'lib/user/crm/contacts.rb', line 94

def create_contact(data, options = nil)
  @client.raw('post', '/crm/contacts', options, 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)
[View source]

140
141
142
# File 'lib/user/crm/contacts.rb', line 140

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)
[View source]

184
185
186
# File 'lib/user/crm/contacts.rb', line 184

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)
[View source]

154
155
156
# File 'lib/user/crm/contacts.rb', line 154

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)
[View source]

198
199
200
# File 'lib/user/crm/contacts.rb', line 198

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)
[View source]

303
304
305
306
# File 'lib/user/crm/contacts.rb', line 303

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

options = {
  sort: 'id',
  'fields[contacts]': 'id, email'
}
@data = @mints_user.get_contact(5, options)
[View source]

75
76
77
# File 'lib/user/crm/contacts.rb', line 75

def get_contact(id, options = nil)
  @client.raw('get', "/crm/contacts/#{id}", options)
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)
[View source]

125
126
127
# File 'lib/user/crm/contacts.rb', line 125

def get_contact_deal(contact_id)
  @client.raw('get', "/crm/contacts/#{contact_id}/deals")
end

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)
[View source]

250
251
252
# File 'lib/user/crm/contacts.rb', line 250

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)
[View source]

211
212
213
# File 'lib/user/crm/contacts.rb', line 211

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)
[View source]

224
225
226
# File 'lib/user/crm/contacts.rb', line 224

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.get_contact_tags(1)
[View source]

237
238
239
# File 'lib/user/crm/contacts.rb', line 237

def get_contact_tags(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)
[View source]

169
170
171
# File 'lib/user/crm/contacts.rb', line 169

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

options = {
  sort: 'id',
  'fields[contacts]': 'id, email'
}
@data = @mints_user.get_contacts(options)

Third Example

options = {
  sort: 'id',
  'fields[contacts]': 'id, email'
}
@data = @mints_user.get_contacts(options, true)
[View source]

54
55
56
# File 'lib/user/crm/contacts.rb', line 54

def get_contacts(options = nil, use_post = true)
  get_query_results('/crm/contacts', options, use_post)
end

#get_contacts_support_dataObject

Get contacts support data.

Example

@data = @mints_user.get_contacts_support_data
[View source]

13
14
15
# File 'lib/user/crm/contacts.rb', line 13

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)
[View source]

26
27
28
# File 'lib/user/crm/contacts.rb', line 26

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)
[View source]

265
266
267
# File 'lib/user/crm/contacts.rb', line 265

def merge_contacts(id, data)
  @client.raw('post', "/crm/contacts/#{id}/merge", nil, data_transform(data))
end

Send magic links.

Send magic links to contacts.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  contacts: %w[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)
[View source]

285
286
287
# File 'lib/user/crm/contacts.rb', line 285

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_modified@example.com',
  company_id: 3
}
@data = @mints_user.update_contact(65, data)
[View source]

112
113
114
# File 'lib/user/crm/contacts.rb', line 112

def update_contact(id, data, options = nil)
  @client.raw('put', "/crm/contacts/#{id}", options, data_transform(data))
end