mints 0.0.17 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/lib/client.rb +96 -37
- data/lib/contact.rb +659 -94
- data/lib/generators/mints_files_generator.rb +6 -0
- data/lib/generators/mints_link.rb +61 -0
- data/lib/generators/short_link_controller.rb +41 -0
- data/lib/mints/controllers/admin_base_controller.rb +2 -2
- data/lib/mints/controllers/base_api_controller.rb +12 -11
- data/lib/mints/controllers/base_controller.rb +38 -9
- data/lib/mints_helper.rb +47 -0
- data/lib/pub.rb +258 -139
- data/lib/user/config/api_keys.rb +65 -0
- data/lib/user/config/appointments.rb +221 -0
- data/lib/user/config/attribute_groups.rb +77 -0
- data/lib/user/config/attributes.rb +86 -0
- data/lib/user/config/calendars.rb +89 -0
- data/lib/user/config/config.rb +65 -0
- data/lib/user/config/importers.rb +184 -0
- data/lib/user/config/public_folders.rb +108 -0
- data/lib/user/config/relationships.rb +138 -0
- data/lib/user/config/roles.rb +84 -0
- data/lib/user/config/seeds.rb +14 -0
- data/lib/user/config/system_settings.rb +53 -0
- data/lib/user/config/tags.rb +63 -0
- data/lib/user/config/taxonomies.rb +124 -0
- data/lib/user/config/teams.rb +70 -0
- data/lib/user/config/users.rb +76 -0
- data/lib/user/contacts/contacts.rb +21 -0
- data/lib/user/content/assets.rb +260 -0
- data/lib/user/content/content.rb +235 -0
- data/lib/user/content/content_instances.rb +147 -0
- data/lib/user/content/content_templates.rb +111 -0
- data/lib/user/content/conversations.rb +174 -0
- data/lib/user/content/dam.rb +88 -0
- data/lib/user/content/forms.rb +168 -0
- data/lib/user/content/message_templates.rb +162 -0
- data/lib/user/content/messages.rb +90 -0
- data/lib/user/content/pages.rb +81 -0
- data/lib/user/content/stories.rb +164 -0
- data/lib/user/content/story_templates.rb +95 -0
- data/lib/user/crm/companies.rb +111 -0
- data/lib/user/crm/contacts.rb +312 -0
- data/lib/user/crm/crm.rb +21 -0
- data/lib/user/crm/deals.rb +111 -0
- data/lib/user/crm/favorites.rb +17 -0
- data/lib/user/crm/segments.rb +132 -0
- data/lib/user/crm/users.rb +22 -0
- data/lib/user/crm/workflow_step_objects.rb +89 -0
- data/lib/user/crm/workflow_steps.rb +49 -0
- data/lib/user/crm/workflows.rb +70 -0
- data/lib/user/ecommerce/ecommerce.rb +29 -0
- data/lib/user/ecommerce/item_prices.rb +86 -0
- data/lib/user/ecommerce/locations.rb +166 -0
- data/lib/user/ecommerce/order_items_groups.rb +109 -0
- data/lib/user/ecommerce/order_statuses.rb +26 -0
- data/lib/user/ecommerce/orders.rb +258 -0
- data/lib/user/ecommerce/price_lists.rb +73 -0
- data/lib/user/ecommerce/product_templates.rb +104 -0
- data/lib/user/ecommerce/product_variations.rb +129 -0
- data/lib/user/ecommerce/products.rb +169 -0
- data/lib/user/ecommerce/skus.rb +88 -0
- data/lib/user/ecommerce/taxes.rb +82 -0
- data/lib/user/ecommerce/variant_options.rb +69 -0
- data/lib/user/ecommerce/variant_values.rb +72 -0
- data/lib/user/helpers/helpers.rb +113 -0
- data/lib/user/helpers/object_activities.rb +83 -0
- data/lib/user/helpers/object_folders.rb +82 -0
- data/lib/user/helpers/user_folders.rb +83 -0
- data/lib/user/marketing/marketing.rb +120 -0
- data/lib/user/profile/profile.rb +111 -0
- data/lib/user.rb +24 -368
- metadata +64 -2
@@ -0,0 +1,164 @@
|
|
1
|
+
module Stories
|
2
|
+
##
|
3
|
+
# == Story
|
4
|
+
#
|
5
|
+
|
6
|
+
# === Publish story.
|
7
|
+
# Publish a story.
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# id:: (Integer) -- Story id.
|
11
|
+
# data:: (Hash) -- Data to be submited.
|
12
|
+
#
|
13
|
+
# ==== Example
|
14
|
+
# data = {
|
15
|
+
# "scheduled_at": "2021-09-06T20:29:16+00:00"
|
16
|
+
# }
|
17
|
+
# @data = @mints_user.publish_story(2, data)
|
18
|
+
def publish_story(id, data)
|
19
|
+
return @client.raw("put", "/content/stories/#{id}/publish", nil, data_transform(data))
|
20
|
+
end
|
21
|
+
|
22
|
+
# === Schedule story.
|
23
|
+
# Schedule a story in a specified date.
|
24
|
+
#
|
25
|
+
# ==== Parameters
|
26
|
+
# id:: (Integer) -- Story id.
|
27
|
+
# data:: (Hash) -- Data to be submited.
|
28
|
+
#
|
29
|
+
# ==== Example
|
30
|
+
# data = {
|
31
|
+
# "scheduled_at": "2021-09-06T20:29:16+00:00"
|
32
|
+
# }
|
33
|
+
# @data = @mints_user.schedule_story(1, data)
|
34
|
+
def schedule_story(id, data)
|
35
|
+
return @client.raw("put", "/content/stories/#{id}/schedule", nil, data_transform(data))
|
36
|
+
end
|
37
|
+
|
38
|
+
# === Revert published story.
|
39
|
+
# Revert a published story.
|
40
|
+
#
|
41
|
+
# ==== Parameters
|
42
|
+
# id:: (Integer) -- Story id.
|
43
|
+
#
|
44
|
+
# ==== Example
|
45
|
+
# @data = @mints_user.revert_published_story(1)
|
46
|
+
def revert_published_story(id)
|
47
|
+
return @client.raw("get", "/content/stories/#{id}/revert-published-data")
|
48
|
+
end
|
49
|
+
|
50
|
+
# === Get stories support data.
|
51
|
+
# Get support data used in stories.
|
52
|
+
#
|
53
|
+
# ==== Example
|
54
|
+
# @data = @mints_user.get_stories_support_data
|
55
|
+
def get_stories_support_data
|
56
|
+
return @client.raw("get", "/content/stories/support-data")
|
57
|
+
end
|
58
|
+
|
59
|
+
# === Duplicate story.
|
60
|
+
# Duplicate a story.
|
61
|
+
#
|
62
|
+
# ==== Parameters
|
63
|
+
# id:: (Integer) -- Story id.
|
64
|
+
# data:: (Hash) -- Data to be submited.
|
65
|
+
#
|
66
|
+
# ==== Example
|
67
|
+
# data = {
|
68
|
+
# "options": []
|
69
|
+
# }
|
70
|
+
# @data = @mints_user.duplicate_story(1, data.to_json)
|
71
|
+
def duplicate_story(id, data)
|
72
|
+
return @client.raw("post", "/content/stories/#{id}/duplicate", nil, data)
|
73
|
+
end
|
74
|
+
|
75
|
+
# === Get stories.
|
76
|
+
# Get a collection of stories.
|
77
|
+
#
|
78
|
+
# ==== Parameters
|
79
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
80
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
81
|
+
#
|
82
|
+
# ==== First Example
|
83
|
+
# @data = @mints_user.get_stories
|
84
|
+
#
|
85
|
+
# ==== Second Example
|
86
|
+
# options = {
|
87
|
+
# "fields": "id, title"
|
88
|
+
# }
|
89
|
+
# @data = @mints_user.get_stories(options)
|
90
|
+
#
|
91
|
+
# ==== Third Example
|
92
|
+
# options = {
|
93
|
+
# "fields": "id, title"
|
94
|
+
# }
|
95
|
+
# @data = @mints_user.get_stories(options, true)
|
96
|
+
def get_stories(options = nil, use_post = true)
|
97
|
+
return get_query_results("/content/stories", options, use_post)
|
98
|
+
end
|
99
|
+
|
100
|
+
# === Get story.
|
101
|
+
# Get a story info.
|
102
|
+
#
|
103
|
+
# ==== Parameters
|
104
|
+
# id:: (Integer) -- Story id.
|
105
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
106
|
+
#
|
107
|
+
# ==== First Example
|
108
|
+
# @data = @mints_user.get_story(1)
|
109
|
+
#
|
110
|
+
# ==== Second Example
|
111
|
+
# options = {
|
112
|
+
# "fields": "id, title"
|
113
|
+
# }
|
114
|
+
# @data = @mints_user.get_story(1, options)
|
115
|
+
def get_story(id, options = nil)
|
116
|
+
return @client.raw("get", "/content/stories/#{id}", options)
|
117
|
+
end
|
118
|
+
|
119
|
+
# === Create story.
|
120
|
+
# Create a story with data.
|
121
|
+
#
|
122
|
+
# ==== Parameters
|
123
|
+
# data:: (Hash) -- Data to be submited.
|
124
|
+
#
|
125
|
+
# ==== Example
|
126
|
+
# data = {
|
127
|
+
# "title": "New Story",
|
128
|
+
# "slug": "new-story",
|
129
|
+
# "social_metadata": "social metadata"
|
130
|
+
# }
|
131
|
+
# @data = @mints_user.create_story(data)
|
132
|
+
def create_story(data)
|
133
|
+
return @client.raw("post", "/content/stories", nil, data_transform(data))
|
134
|
+
end
|
135
|
+
|
136
|
+
# === Update story.
|
137
|
+
# Update a story info.
|
138
|
+
#
|
139
|
+
# ==== Parameters
|
140
|
+
# id:: (Integer) -- Story id.
|
141
|
+
# data:: (Hash) -- Data to be submited.
|
142
|
+
#
|
143
|
+
# ==== Example
|
144
|
+
# data = {
|
145
|
+
# "title": "New Story Modified",
|
146
|
+
# "slug": "new-story"
|
147
|
+
# }
|
148
|
+
# @data = @mints_user.update_story(5, data)
|
149
|
+
def update_story(id, data)
|
150
|
+
return @client.raw("put", "/content/stories/#{id}", nil, data_transform(data))
|
151
|
+
end
|
152
|
+
|
153
|
+
# === Delete story.
|
154
|
+
# Delete a story.
|
155
|
+
#
|
156
|
+
# ==== Parameters
|
157
|
+
# id:: (Integer) -- Story id.
|
158
|
+
#
|
159
|
+
# ==== Example
|
160
|
+
# @data = @mints_user.delete_story(6)
|
161
|
+
def delete_story(id)
|
162
|
+
return @client.raw("delete", "/content/stories/#{id}")
|
163
|
+
end
|
164
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
module StoryTemplates
|
2
|
+
##
|
3
|
+
# == Story Template
|
4
|
+
#
|
5
|
+
|
6
|
+
# === Get support data of story template.
|
7
|
+
# Get support data used in a story template.
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# id:: (Integer) -- Story template id.
|
11
|
+
#
|
12
|
+
# ==== Example
|
13
|
+
# @data = @mints_user.get_story_template_support_data(1)
|
14
|
+
def get_story_template_support_data(id)
|
15
|
+
return @client.raw("get", "/content/story-templates/support-data/stories/#{id}")
|
16
|
+
end
|
17
|
+
|
18
|
+
# === Get support data of story templates.
|
19
|
+
# Get support data used in story templates.
|
20
|
+
#
|
21
|
+
# ==== Example
|
22
|
+
# @data = @mints_user.get_story_templates_support_data
|
23
|
+
def get_story_templates_support_data
|
24
|
+
return @client.raw("get", "/content/story-templates/support-data")
|
25
|
+
end
|
26
|
+
|
27
|
+
# === Get story templates.
|
28
|
+
# Get a collection of story templates.
|
29
|
+
#
|
30
|
+
# ==== Parameters
|
31
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
32
|
+
#
|
33
|
+
# ==== First Example
|
34
|
+
# @data = @mints_user.get_story_templates
|
35
|
+
#
|
36
|
+
# ==== Second Example
|
37
|
+
# options = {
|
38
|
+
# "fields": "id, title"
|
39
|
+
# }
|
40
|
+
# @data = @mints_user.get_story_templates(options)
|
41
|
+
def get_story_templates(options = nil)
|
42
|
+
return @client.raw("get", "/content/story-templates", options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# === Get story template.
|
46
|
+
# Get a story template info.
|
47
|
+
#
|
48
|
+
# ==== Parameters
|
49
|
+
# id:: (Integer) -- Story template id.
|
50
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
51
|
+
#
|
52
|
+
# ==== First Example
|
53
|
+
# @data = @mints_user.get_story_template(2)
|
54
|
+
#
|
55
|
+
# ==== Second Example
|
56
|
+
# options = {
|
57
|
+
# "fields": "title"
|
58
|
+
# }
|
59
|
+
# @data = @mints_user.get_story_template(1, options)
|
60
|
+
def get_story_template(id, options = nil)
|
61
|
+
return @client.raw("get", "/content/story-templates/#{id}", options)
|
62
|
+
end
|
63
|
+
|
64
|
+
# === Create story template.
|
65
|
+
# Create a story template with data.
|
66
|
+
#
|
67
|
+
# ==== Parameters
|
68
|
+
# data:: (Hash) -- Data to be submited.
|
69
|
+
#
|
70
|
+
# ==== Example
|
71
|
+
# data = {
|
72
|
+
# "title": "New Story Template",
|
73
|
+
# "slug": "new-story-template-slug"
|
74
|
+
# }
|
75
|
+
# @data = @mints_user.create_story_template(data)
|
76
|
+
def create_story_template(data)
|
77
|
+
return @client.raw("post", "/content/story-templates", nil, data_transform(data))
|
78
|
+
end
|
79
|
+
|
80
|
+
# === Update story template.
|
81
|
+
# Update a story template info.
|
82
|
+
#
|
83
|
+
# ==== Parameters
|
84
|
+
# id:: (Integer) -- Story template id.
|
85
|
+
# data:: (Hash) -- Data to be submited.
|
86
|
+
#
|
87
|
+
# ==== Example
|
88
|
+
# data = {
|
89
|
+
# "title": "New Story Template Modified"
|
90
|
+
# }
|
91
|
+
# @data = @mints_user.update_story_template(3, data)
|
92
|
+
def update_story_template(id, data)
|
93
|
+
return @client.raw("put", "/content/story-templates/#{id}", nil, data_transform(data))
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module Companies
|
2
|
+
##
|
3
|
+
# == Companies
|
4
|
+
#
|
5
|
+
|
6
|
+
##
|
7
|
+
# === Get companies support data.
|
8
|
+
# Get support data of companies.
|
9
|
+
#
|
10
|
+
# ==== Example
|
11
|
+
# @data = @mints_user.get_companies_support_data
|
12
|
+
def get_companies_support_data
|
13
|
+
return @client.raw("get", "/crm/companies/support-data")
|
14
|
+
end
|
15
|
+
|
16
|
+
# === Get companies.
|
17
|
+
# Get a collection of companies.
|
18
|
+
#
|
19
|
+
# ==== Parameters
|
20
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
21
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
22
|
+
#
|
23
|
+
# ==== First Example
|
24
|
+
# @data = @mints_user.get_companies
|
25
|
+
#
|
26
|
+
# ==== Second Example
|
27
|
+
# options = { "fields": "id, title", "sort": "-id" }
|
28
|
+
# @data = @mints_user.get_companies(options)
|
29
|
+
#
|
30
|
+
# ==== Third Example
|
31
|
+
# options = { "fields": "id, title", "sort": "-id" }
|
32
|
+
# @data = @mints_user.get_companies(options, false)
|
33
|
+
def get_companies(options = nil, use_post = true)
|
34
|
+
return get_query_results("/crm/companies", options, use_post)
|
35
|
+
end
|
36
|
+
|
37
|
+
# === Get company.
|
38
|
+
# Get a company info.
|
39
|
+
#
|
40
|
+
# ==== Parameters
|
41
|
+
# id:: (Integer) -- Company id.
|
42
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
43
|
+
#
|
44
|
+
# ==== First Example
|
45
|
+
# @data = @mints_user.get_company(21)
|
46
|
+
#
|
47
|
+
# ==== Second Example
|
48
|
+
# options = { "fields": "id, title" }
|
49
|
+
# @data = @mints_user.get_company(21, options)
|
50
|
+
def get_company(id, options = nil)
|
51
|
+
return @client.raw("get", "/crm/companies/#{id}", options)
|
52
|
+
end
|
53
|
+
|
54
|
+
# === Create company.
|
55
|
+
# Create a company with data.
|
56
|
+
#
|
57
|
+
# ==== Parameters
|
58
|
+
# data:: (Hash) -- Data to be submited.
|
59
|
+
#
|
60
|
+
# ==== Example
|
61
|
+
# data = {
|
62
|
+
# "title": "Company Title",
|
63
|
+
# "alias": "Alias",
|
64
|
+
# "website": "www.company.example.com",
|
65
|
+
# "street1": "Company St",
|
66
|
+
# "city": "Company City",
|
67
|
+
# "region": "Company Region",
|
68
|
+
# "postal_code": "12345",
|
69
|
+
# "country_id": 144,
|
70
|
+
# "tax_identifier": nil
|
71
|
+
# }
|
72
|
+
# @data = @mints_user.create_company(data)
|
73
|
+
def create_company(data)
|
74
|
+
return @client.raw("post", "/crm/companies/", nil, data_transform(data))
|
75
|
+
end
|
76
|
+
|
77
|
+
# === Update company.
|
78
|
+
# Update a company info.
|
79
|
+
#
|
80
|
+
# ==== Parameters
|
81
|
+
# id:: (Integer) -- Company id.
|
82
|
+
# data:: (Hash) -- Data to be submited.
|
83
|
+
#
|
84
|
+
# ==== Example
|
85
|
+
# data = {
|
86
|
+
# "title": "Company Title Modified"
|
87
|
+
# }
|
88
|
+
# @data = @mints_user.update_company(23, data)
|
89
|
+
def update_company(id, data)
|
90
|
+
return @client.raw("put", "/crm/companies/#{id}", nil, data_transform(data))
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# == Companies Bulk Actions
|
95
|
+
#
|
96
|
+
|
97
|
+
# === Delete Companies.
|
98
|
+
# Delete a group of companies.
|
99
|
+
#
|
100
|
+
# ==== Parameters
|
101
|
+
# data:: (Hash) -- Data to be submited.
|
102
|
+
#
|
103
|
+
# ==== Example
|
104
|
+
# data = {
|
105
|
+
# "ids": [ 21, 22 ]
|
106
|
+
# }
|
107
|
+
# @data = @mints_user.delete_companies(data)
|
108
|
+
def delete_companies(data)
|
109
|
+
return @client.raw("delete", "/crm/companies/delete", nil, data_transform(data))
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,312 @@
|
|
1
|
+
module Contacts
|
2
|
+
##
|
3
|
+
# == Contacts
|
4
|
+
#
|
5
|
+
|
6
|
+
##
|
7
|
+
# === Get contacts support data.
|
8
|
+
#
|
9
|
+
# ==== Example
|
10
|
+
# @data = @mints_user.get_contacts_support_data
|
11
|
+
def get_contacts_support_data
|
12
|
+
return @client.raw("get", "/crm/contacts/support-data")
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# === Get online activity.
|
17
|
+
# Get online activity of a contact.
|
18
|
+
#
|
19
|
+
# ==== Parameters
|
20
|
+
# id:: (Integer) -- Contact id.
|
21
|
+
#
|
22
|
+
# ==== Example
|
23
|
+
# @data = @mints_user.get_online_activity(5)
|
24
|
+
def get_online_activity(id)
|
25
|
+
return @client.raw("get", "/crm/contacts/#{id}/online-activity")
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# === Get contacts.
|
30
|
+
# Get a collection of contacts.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
34
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
35
|
+
#
|
36
|
+
# ==== First Example
|
37
|
+
# @data = @mints_user.get_contacts
|
38
|
+
#
|
39
|
+
# ==== Second Example
|
40
|
+
# options = {
|
41
|
+
# "sort": "id",
|
42
|
+
# "fields[contacts]": "id, email"
|
43
|
+
# }
|
44
|
+
# @data = @mints_user.get_contacts(options)
|
45
|
+
#
|
46
|
+
# ==== Third Example
|
47
|
+
# options = {
|
48
|
+
# "sort": "id",
|
49
|
+
# "fields[contacts]": "id, email"
|
50
|
+
# }
|
51
|
+
# @data = @mints_user.get_contacts(options, true)
|
52
|
+
def get_contacts(options = nil, use_post = true)
|
53
|
+
return get_query_results("/crm/contacts", options, use_post)
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# === Get contact.
|
58
|
+
# Get a contact data.
|
59
|
+
#
|
60
|
+
# ==== Parameters
|
61
|
+
# id:: (Integer) -- Contact id.
|
62
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
63
|
+
#
|
64
|
+
# ==== First Example
|
65
|
+
# @data = @mints_user.get_contact(5)
|
66
|
+
#
|
67
|
+
# ==== Second Example
|
68
|
+
# options = {
|
69
|
+
# "sort": "id",
|
70
|
+
# "fields[contacts]": "id, email"
|
71
|
+
# }
|
72
|
+
# @data = @mints_user.get_contact(5, options)
|
73
|
+
def get_contact(id, options = nil)
|
74
|
+
return @client.raw("get", "/crm/contacts/#{id}", options)
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# === Create contact.
|
79
|
+
# Create a contact with data.
|
80
|
+
#
|
81
|
+
# ==== Parameters
|
82
|
+
# data:: (Hash) -- Data to be submited.
|
83
|
+
#
|
84
|
+
# ==== Example
|
85
|
+
# data = {
|
86
|
+
# "email": "email@example.com",
|
87
|
+
# "given_name": "Given_Name",
|
88
|
+
# "last_name": "Last_Name",
|
89
|
+
# "password": "123456"
|
90
|
+
# }
|
91
|
+
# @data = @mints_user.create_contact(data)
|
92
|
+
def create_contact(data)
|
93
|
+
return @client.raw("post", "/crm/contacts", nil, data_transform(data))
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# === Update contact.
|
98
|
+
# Update contact data.
|
99
|
+
#
|
100
|
+
# ==== Parameters
|
101
|
+
# id:: (Integer) -- Contact id.
|
102
|
+
# data:: (Hash) -- Data to be submited.
|
103
|
+
#
|
104
|
+
# ==== Example
|
105
|
+
# data = {
|
106
|
+
# "email": "email_modified@example.com",
|
107
|
+
# "company_id": 3
|
108
|
+
# }
|
109
|
+
# @data = @mints_user.update_contact(65, data)
|
110
|
+
def update_contact(id, data)
|
111
|
+
return @client.raw("put", "/crm/contacts/#{id}", nil, data_transform(data))
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# === Get contact deals.
|
116
|
+
# Get a collection of deals of a contact.
|
117
|
+
#
|
118
|
+
# ==== Parameters
|
119
|
+
# contact_id:: (Integer) -- Contact id.
|
120
|
+
#
|
121
|
+
# ==== Example
|
122
|
+
# @data = @mints_user.get_contact_deal(5)
|
123
|
+
def get_contact_deal(contact_id)
|
124
|
+
return @client.raw("get", "/crm/contacts/#{contact_id}/deals")
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# === Create contact deal.
|
129
|
+
# Create a contact deal with data.
|
130
|
+
#
|
131
|
+
# ==== Parameters
|
132
|
+
# contact_id:: (Integer) -- Contact id.
|
133
|
+
# data:: (Hash) -- Data to be submited.
|
134
|
+
#
|
135
|
+
# ==== Example
|
136
|
+
# data = {
|
137
|
+
# "deal_id": 6
|
138
|
+
# }
|
139
|
+
# @data = @mints_user.create_contact_deal(5, data.to_json)
|
140
|
+
def create_contact_deal(contact_id, data)
|
141
|
+
return @client.raw("post", "/crm/contacts/#{contact_id}/deals", nil, data)
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# === Delete contact deal.
|
146
|
+
# Delete a contact deal with data.
|
147
|
+
#
|
148
|
+
# ==== Parameters
|
149
|
+
# contact_id:: (Integer) -- Contact id.
|
150
|
+
# deal_id:: (Integer) -- Deal id.
|
151
|
+
#
|
152
|
+
# ==== Example
|
153
|
+
# @data = @mints_user.delete_contact_deal(5, 100)
|
154
|
+
def delete_contact_deal(contact_id, deal_id)
|
155
|
+
return @client.raw("delete", "/crm/contacts/#{contact_id}/deals/#{deal_id}")
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# === Get contact user.
|
160
|
+
# Get user data of a contact.
|
161
|
+
#
|
162
|
+
# ==== Parameters
|
163
|
+
# contact_id:: (Integer) -- Contact id.
|
164
|
+
#TODO: Replace Resource collection options url
|
165
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
166
|
+
#
|
167
|
+
# ==== Example
|
168
|
+
# @data = @mints_user.get_contact_user(66)
|
169
|
+
def get_contact_user(contact_id)
|
170
|
+
return @client.raw("get", "/crm/contacts/#{contact_id}/users")
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# === Create contact user.
|
175
|
+
# Relate a contact with an user.
|
176
|
+
#
|
177
|
+
# ==== Parameters
|
178
|
+
# contact_id:: (Integer) -- Contact id.
|
179
|
+
# data:: (Hash) -- Data to be submited.
|
180
|
+
#
|
181
|
+
# ==== Example
|
182
|
+
# data = {
|
183
|
+
# "user_id": 9
|
184
|
+
# }
|
185
|
+
# @data = @mints_user.create_contact_user(66, data.to_json)
|
186
|
+
def create_contact_user(contact_id, data)
|
187
|
+
return @client.raw("post", "/crm/contacts/#{contact_id}/users", nil, data)
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# === Delete contact user.
|
192
|
+
# Delete a relationship between a contact and an user.
|
193
|
+
#
|
194
|
+
# ==== Parameters
|
195
|
+
# contact_id:: (Integer) -- Contact id.
|
196
|
+
# id:: (Integer) -- User id.
|
197
|
+
#
|
198
|
+
# ==== Example
|
199
|
+
# @data = @mints_user.delete_contact_user(153, 9)
|
200
|
+
def delete_contact_user(contact_id, id)
|
201
|
+
return @client.raw("delete", "/crm/contacts/#{contact_id}/users/#{id}")
|
202
|
+
end
|
203
|
+
|
204
|
+
##
|
205
|
+
# === Get contact segments.
|
206
|
+
# Get segments of a contact.
|
207
|
+
#
|
208
|
+
# ==== Parameters
|
209
|
+
# contact_id:: (Integer) -- Contact id.
|
210
|
+
#
|
211
|
+
# ==== Example
|
212
|
+
# @data = @mints_user.get_contact_segments(1)
|
213
|
+
def get_contact_segments(contact_id)
|
214
|
+
return @client.raw("get", "/crm/contacts/#{contact_id}/segments")
|
215
|
+
end
|
216
|
+
|
217
|
+
##
|
218
|
+
# === Get contact submissions.
|
219
|
+
# Get submissions of a contact.
|
220
|
+
#
|
221
|
+
# ==== Parameters
|
222
|
+
# contact_id:: (Integer) -- Contact id.
|
223
|
+
#
|
224
|
+
# ==== Example
|
225
|
+
# @data = @mints_user.get_contact_submissions(146)
|
226
|
+
def get_contact_submissions(contact_id)
|
227
|
+
return @client.raw("get", "/crm/contacts/#{contact_id}/submissions")
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# === Get contact tags.
|
232
|
+
# Get tags of a contact.
|
233
|
+
#
|
234
|
+
# ==== Parameters
|
235
|
+
# contact_id:: (Integer) -- Contact id.
|
236
|
+
#
|
237
|
+
# ==== Example
|
238
|
+
# @data = @mints_user.get_contact_tags(1)
|
239
|
+
def get_contact_tags(contact_id)
|
240
|
+
return @client.raw("get", "/crm/contacts/#{contact_id}/tags")
|
241
|
+
end
|
242
|
+
|
243
|
+
##
|
244
|
+
# === Get contact magic links.
|
245
|
+
# Get magic links of a contact.
|
246
|
+
#
|
247
|
+
# ==== Parameters
|
248
|
+
# contact_id:: (Integer) -- Contact id.
|
249
|
+
#
|
250
|
+
# ==== Example
|
251
|
+
# @data = @mints_user.get_contact_magic_links(150)
|
252
|
+
def get_contact_magic_links(contact_id)
|
253
|
+
return @client.raw("get", "/crm/contacts/#{contact_id}/magic-links")
|
254
|
+
end
|
255
|
+
|
256
|
+
##
|
257
|
+
# === Create contact merge.
|
258
|
+
# Merge contacts.
|
259
|
+
#
|
260
|
+
# ==== Parameters
|
261
|
+
# id:: (Integer) -- Contact id.
|
262
|
+
# data:: (Hash) -- Data to be submited. It contains ids to be merged.
|
263
|
+
#
|
264
|
+
# ==== Example
|
265
|
+
# data = {
|
266
|
+
# "mergeContactIds": [152]
|
267
|
+
# }
|
268
|
+
# @data = @mints_user.merge_contacts(151, data)
|
269
|
+
def merge_contacts(id, data)
|
270
|
+
return @client.raw("post", "/crm/contacts/#{id}/merge", nil, data_transform(data))
|
271
|
+
end
|
272
|
+
|
273
|
+
##
|
274
|
+
# === Send magic links.
|
275
|
+
# Send magic links to contacts.
|
276
|
+
#
|
277
|
+
# ==== Parameters
|
278
|
+
# data:: (Hash) -- Data to be submited.
|
279
|
+
#
|
280
|
+
# ==== Example
|
281
|
+
# data = {
|
282
|
+
# "contacts": ["email_1@example.com", "email_2@example.com", "email_3@example.com"],
|
283
|
+
# "templateId": 2,
|
284
|
+
# "redirectUrl": "",
|
285
|
+
# "lifeTime": 1440,
|
286
|
+
# "maxVisits": 3
|
287
|
+
# }
|
288
|
+
# @data = @mints_user.send_magic_links(data)
|
289
|
+
def send_magic_links(data)
|
290
|
+
return @client.raw("post", "/crm/contacts/send-magic-link", nil, data_transform(data))
|
291
|
+
end
|
292
|
+
|
293
|
+
##
|
294
|
+
# == Contacts Bulk Actions
|
295
|
+
#
|
296
|
+
|
297
|
+
##
|
298
|
+
# === Delete contacts.
|
299
|
+
# Delete different contacts.
|
300
|
+
#
|
301
|
+
# ==== Parameters
|
302
|
+
# data:: (Hash) -- Data to be submited.
|
303
|
+
#
|
304
|
+
# ==== Example
|
305
|
+
# data = {
|
306
|
+
# "ids": [ 67, 68, 69 ]
|
307
|
+
# }
|
308
|
+
# @data = @mints_user.delete_contacts(data)
|
309
|
+
def delete_contacts(data) #TODO: ContactController.delete need a success output
|
310
|
+
return @client.raw("delete", "/crm/contacts/delete", nil, data_transform(data))
|
311
|
+
end
|
312
|
+
end
|
data/lib/user/crm/crm.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative './companies.rb'
|
2
|
+
require_relative './contacts.rb'
|
3
|
+
require_relative './deals.rb'
|
4
|
+
require_relative './favorites.rb'
|
5
|
+
require_relative './segments.rb'
|
6
|
+
require_relative './users.rb'
|
7
|
+
require_relative './workflow_step_objects.rb'
|
8
|
+
require_relative './workflow_steps.rb'
|
9
|
+
require_relative './workflows.rb'
|
10
|
+
|
11
|
+
module CRM
|
12
|
+
include Companies
|
13
|
+
include Contacts
|
14
|
+
include Deals
|
15
|
+
include Favorites
|
16
|
+
include Segments
|
17
|
+
include Users
|
18
|
+
include WorkflowStepObjects
|
19
|
+
include WorkFlowSteps
|
20
|
+
include Workflows
|
21
|
+
end
|