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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/lib/client.rb +96 -37
  4. data/lib/contact.rb +659 -94
  5. data/lib/generators/mints_files_generator.rb +6 -0
  6. data/lib/generators/mints_link.rb +61 -0
  7. data/lib/generators/short_link_controller.rb +41 -0
  8. data/lib/mints/controllers/admin_base_controller.rb +2 -2
  9. data/lib/mints/controllers/base_api_controller.rb +12 -11
  10. data/lib/mints/controllers/base_controller.rb +38 -9
  11. data/lib/mints_helper.rb +47 -0
  12. data/lib/pub.rb +258 -139
  13. data/lib/user/config/api_keys.rb +65 -0
  14. data/lib/user/config/appointments.rb +221 -0
  15. data/lib/user/config/attribute_groups.rb +77 -0
  16. data/lib/user/config/attributes.rb +86 -0
  17. data/lib/user/config/calendars.rb +89 -0
  18. data/lib/user/config/config.rb +65 -0
  19. data/lib/user/config/importers.rb +184 -0
  20. data/lib/user/config/public_folders.rb +108 -0
  21. data/lib/user/config/relationships.rb +138 -0
  22. data/lib/user/config/roles.rb +84 -0
  23. data/lib/user/config/seeds.rb +14 -0
  24. data/lib/user/config/system_settings.rb +53 -0
  25. data/lib/user/config/tags.rb +63 -0
  26. data/lib/user/config/taxonomies.rb +124 -0
  27. data/lib/user/config/teams.rb +70 -0
  28. data/lib/user/config/users.rb +76 -0
  29. data/lib/user/contacts/contacts.rb +21 -0
  30. data/lib/user/content/assets.rb +260 -0
  31. data/lib/user/content/content.rb +235 -0
  32. data/lib/user/content/content_instances.rb +147 -0
  33. data/lib/user/content/content_templates.rb +111 -0
  34. data/lib/user/content/conversations.rb +174 -0
  35. data/lib/user/content/dam.rb +88 -0
  36. data/lib/user/content/forms.rb +168 -0
  37. data/lib/user/content/message_templates.rb +162 -0
  38. data/lib/user/content/messages.rb +90 -0
  39. data/lib/user/content/pages.rb +81 -0
  40. data/lib/user/content/stories.rb +164 -0
  41. data/lib/user/content/story_templates.rb +95 -0
  42. data/lib/user/crm/companies.rb +111 -0
  43. data/lib/user/crm/contacts.rb +312 -0
  44. data/lib/user/crm/crm.rb +21 -0
  45. data/lib/user/crm/deals.rb +111 -0
  46. data/lib/user/crm/favorites.rb +17 -0
  47. data/lib/user/crm/segments.rb +132 -0
  48. data/lib/user/crm/users.rb +22 -0
  49. data/lib/user/crm/workflow_step_objects.rb +89 -0
  50. data/lib/user/crm/workflow_steps.rb +49 -0
  51. data/lib/user/crm/workflows.rb +70 -0
  52. data/lib/user/ecommerce/ecommerce.rb +29 -0
  53. data/lib/user/ecommerce/item_prices.rb +86 -0
  54. data/lib/user/ecommerce/locations.rb +166 -0
  55. data/lib/user/ecommerce/order_items_groups.rb +109 -0
  56. data/lib/user/ecommerce/order_statuses.rb +26 -0
  57. data/lib/user/ecommerce/orders.rb +258 -0
  58. data/lib/user/ecommerce/price_lists.rb +73 -0
  59. data/lib/user/ecommerce/product_templates.rb +104 -0
  60. data/lib/user/ecommerce/product_variations.rb +129 -0
  61. data/lib/user/ecommerce/products.rb +169 -0
  62. data/lib/user/ecommerce/skus.rb +88 -0
  63. data/lib/user/ecommerce/taxes.rb +82 -0
  64. data/lib/user/ecommerce/variant_options.rb +69 -0
  65. data/lib/user/ecommerce/variant_values.rb +72 -0
  66. data/lib/user/helpers/helpers.rb +113 -0
  67. data/lib/user/helpers/object_activities.rb +83 -0
  68. data/lib/user/helpers/object_folders.rb +82 -0
  69. data/lib/user/helpers/user_folders.rb +83 -0
  70. data/lib/user/marketing/marketing.rb +120 -0
  71. data/lib/user/profile/profile.rb +111 -0
  72. data/lib/user.rb +24 -368
  73. metadata +64 -2
@@ -0,0 +1,124 @@
1
+ module Taxonomies
2
+ ##
3
+ # == Taxonomies
4
+ #
5
+
6
+ # === Sync taxonomies for object.
7
+ # Sync taxonomies for object.
8
+ #
9
+ # ==== Parameters
10
+ # data:: (Hash) -- Data to be submited.
11
+ #
12
+ # ==== Example
13
+ # data = {
14
+ # "object_type": "contacts",
15
+ # "object_id": 1
16
+ # }
17
+ # @data = @mints_user.sync_taxonomies_for_object(data)
18
+ def sync_taxonomies_for_object(data)
19
+ return @client.raw("put", "/config/taxonomies/sync_taxonomies_for_object", nil, data_transform(data))
20
+ end
21
+
22
+ # === Get taxonomies for object.
23
+ # Get taxonomies for object.
24
+ #
25
+ # ==== Parameters
26
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
27
+ #
28
+ # ==== Example
29
+ # options = {
30
+ # "object_type": "contacts",
31
+ # "object_id": 1
32
+ # }
33
+ # @data = @mints_user.get_taxonomies_for_object(options)
34
+ def get_taxonomies_for_object(options)
35
+ return @client.raw("get", "/config/taxonomies/get_taxonomies_for_object", options)
36
+ end
37
+
38
+ # === Get taxonomies support data.
39
+ # Get support data used in taxonomies.
40
+ #
41
+ # ==== Example
42
+ # @data = @mints_user.get_taxonomies_support_data
43
+ def get_taxonomies_support_data
44
+ return @client.raw("get", "/config/taxonomies/support-data")
45
+ end
46
+
47
+ #FIXME: Method doesnt exist in TaxonomyController.getUISupportData
48
+ #def get_ui_taxonomy(id)
49
+ # return @client.raw("get", "/config/taxonomies/ui-taxonomies/#{id}")
50
+ #end
51
+
52
+ # === Get taxonomies.
53
+ # Get a collection of taxonomies.
54
+ #
55
+ # ==== Parameters
56
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
57
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
58
+ #
59
+ # ==== First Example
60
+ # @data = @mints_user.get_taxonomies
61
+ #
62
+ # ==== Second Example
63
+ # options = { "fields": "title" }
64
+ # @data = @mints_user.get_taxonomies(options)
65
+ #
66
+ # ==== Third Example
67
+ # options = { "fields": "title" }
68
+ # @data = @mints_user.get_taxonomies(options, false)
69
+ def get_taxonomies(options = nil, use_post = true)
70
+ return get_query_results("/config/taxonomies", options, use_post)
71
+ end
72
+
73
+ # === Get taxonomy.
74
+ # Get a taxonomy info.
75
+ #
76
+ # ==== Parameters
77
+ # id:: (Integer) -- Taxonomy id.
78
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
79
+ #
80
+ # ==== First Example
81
+ # @data = @mints_user.get_taxonomy(1)
82
+ #
83
+ # ==== Second Example
84
+ # options = { "fields": "title" }
85
+ # @data = @mints_user.get_taxonomy(1, options)
86
+ def get_taxonomy(id, options = nil)
87
+ return @client.raw("get", "/config/taxonomies/#{id}", options)
88
+ end
89
+
90
+ # === Create taxonomy.
91
+ # Create a taxonomy with data.
92
+ #
93
+ # ==== Parameters
94
+ # data:: (Hash) -- Data to be submited.
95
+ #
96
+ # ==== Example
97
+ # data = {
98
+ # "title": "New Taxonomy",
99
+ # "slug": "new-taxonomy",
100
+ # "object_type": "contacts"
101
+ # }
102
+ # @data = @mints_user.create_taxonomy(data)
103
+ def create_taxonomy(data)
104
+ return @client.raw("post", "/config/taxonomies", nil, data_transform(data))
105
+ end
106
+
107
+ # === Update taxonomy.
108
+ # Update a taxonomy info.
109
+ #
110
+ # ==== Parameters
111
+ # id:: (Integer) -- Taxonomy id.
112
+ # data:: (Hash) -- Data to be submited.
113
+ #
114
+ # ==== Example
115
+ # data = {
116
+ # "title": "New Taxomony Modified",
117
+ # "slug": "new-taxonomy",
118
+ # "object_type": "contacts"
119
+ # }
120
+ # @data = @mints_user.update_taxonomy(104, data)
121
+ def update_taxonomy(id, data)
122
+ return @client.raw("put", "/config/taxonomies/#{id}", nil, data_transform(data))
123
+ end
124
+ end
@@ -0,0 +1,70 @@
1
+ module Teams
2
+ ##
3
+ # == Teams
4
+ #
5
+
6
+ # === Get team types.
7
+ # Get a collection of team types.
8
+ #
9
+ # ==== Example
10
+ # @data = @mints_user.get_team_types
11
+ def get_team_types
12
+ return @client.raw("get", "/config/teams/team-types")
13
+ end
14
+
15
+ # === Get teams.
16
+ # Get a collection of teams.
17
+ #
18
+ # ==== Example
19
+ # @data = @mints_user.get_teams
20
+ def get_teams
21
+ return @client.raw("get", "/config/teams")
22
+ end
23
+
24
+ # === Get team.
25
+ # Get a team info.
26
+ #
27
+ # ==== Parameters
28
+ # id:: (Integer) -- Team id.
29
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
30
+ #
31
+ # ==== Example
32
+ # @data = @mints_user.get_team(1)
33
+ def get_team(id)
34
+ return @client.raw("get", "/config/teams/#{id}")
35
+ end
36
+
37
+ # === Create team.
38
+ # Create a team with data.
39
+ #
40
+ # ==== Parameters
41
+ # data:: (Hash) -- Data to be submited.
42
+ #
43
+ # ==== Example
44
+ # data = {
45
+ # "title": "New Team",
46
+ # "team_type_enum": 1
47
+ # }
48
+ # @data = @mints_user.create_team(data)
49
+ def create_team(data)
50
+ return @client.raw("post", "/config/teams", nil, data_transform(data))
51
+ end
52
+
53
+ # === Update team.
54
+ # Update a team info.
55
+ #
56
+ # ==== Parameters
57
+ # id:: (Integer) -- Team id.
58
+ # data:: (Hash) -- Data to be submited.
59
+ #
60
+ # ==== Example
61
+ # data = {
62
+ # "title": "New Team Modified",
63
+ # "team_type_enum": 1,
64
+ # "members": []
65
+ # }
66
+ # @data = @mints_user.update_team(5, data)
67
+ def update_team(id, data)
68
+ return @client.raw("put", "/config/teams/#{id}", nil, data_transform(data))
69
+ end
70
+ end
@@ -0,0 +1,76 @@
1
+ module Users
2
+ ##
3
+ # == Users
4
+ #
5
+
6
+ ##
7
+ # === Can Users Coach.
8
+ # Determine if users can coach.
9
+ #
10
+ # ==== Example
11
+ # @data = @mints_user.can_users_coach
12
+ def can_users_coach
13
+ return @client.raw("get", "/config/users/can_coach")
14
+ end
15
+
16
+ # === Get users.
17
+ # Get a collection of users.
18
+ #
19
+ # ==== Example
20
+ # @data = @mints_user.get_users
21
+ def get_users
22
+ return @client.raw("get", "/config/users")
23
+ end
24
+
25
+ # === Get user.
26
+ # Get an user info.
27
+ #
28
+ # ==== Parameters
29
+ # id:: (Integer) -- User id.
30
+ #
31
+ # ==== Example
32
+ # @data = @mints_user.get_user(8)
33
+ def get_user(id)
34
+ return @client.raw("get", "/config/users/#{id}")
35
+ end
36
+
37
+ # === Create user.
38
+ # Create an user with data.
39
+ #
40
+ # ==== Parameters
41
+ # data:: (Hash) -- Data to be submited.
42
+ #
43
+ # ==== Example
44
+ # data = {
45
+ # "name": "New User Name",
46
+ # "email": "new_user_email@example.com",
47
+ # "is_confirmed": false,
48
+ # "set_password": true,
49
+ # "password": "123456",
50
+ # "is_coach": false
51
+ # }
52
+ # @data = @mints_user.create_user(data)
53
+ def create_user(data)
54
+ return @client.raw("post", "/config/users", nil, data_transform(data))
55
+ end
56
+
57
+ # === Update user.
58
+ # Update an user info.
59
+ #
60
+ # ==== Parameters
61
+ # id:: (Integer) -- User id.
62
+ # data:: (Hash) -- Data to be submited.
63
+ #
64
+ # ==== Example
65
+ # data = {
66
+ # "name": "New User Name Modified",
67
+ # "email": "new_user_name@example.com",
68
+ # "is_active": true,
69
+ # "is_confirmed": false,
70
+ # "roles": ""
71
+ # }
72
+ # @data = @mints_user.update_user(14, data)
73
+ def update_user(id, data)
74
+ return @client.raw("put", "/config/users/#{id}", nil, data_transform(data))
75
+ end
76
+ end
@@ -0,0 +1,21 @@
1
+ module Contacts
2
+ ##
3
+ # == Contact Auth
4
+ #
5
+
6
+ # === Change password no auth.
7
+ # Change password to an email without auth.
8
+ #
9
+ # ==== Parameters
10
+ # data:: (Hash) -- Data to be submited.
11
+ #
12
+ # ==== Example
13
+ # data = {
14
+ # "password": "12345678",
15
+ # "email": "email@example.com"
16
+ # }
17
+ # @data = @mints_user.change_password_no_auth(data)
18
+ def change_password_no_auth(data)
19
+ return @client.raw("post", "/contacts/change-password-no-auth", nil, data_transform(data))
20
+ end
21
+ end
@@ -0,0 +1,260 @@
1
+ module Assets
2
+
3
+
4
+ ##
5
+ # == Assets
6
+ #
7
+
8
+
9
+ # === Get asset link info.
10
+ # Get information of an asset by url.
11
+ #
12
+ # ==== Parameters
13
+ # data:: (Hash) -- Data to be submited.
14
+ #
15
+ # ==== Example
16
+ # data = {
17
+ # "link": "https://www.example.com/img/img.jpg"
18
+ # }
19
+ # @data = @mints_user.get_asset_link_info(data.to_json)
20
+ def get_asset_link_info(data)
21
+ return @client.raw("post", "/content/assets/getLinkInfo", nil, data)
22
+ end
23
+
24
+ # === Download asset.
25
+ # Get information of an asset.
26
+ #
27
+ # ==== Parameters
28
+ # id:: (Integer) -- Asset id.
29
+ #
30
+ # ==== Example
31
+ # @data = @mints_user.download_asset(2)
32
+ def download_asset(id) #FIXME: File not found at path, error in result but method works
33
+ return @client.raw("get", "/content/assets/download/#{id}")
34
+ end
35
+
36
+ # FIXME: Returns json invalid token
37
+ # def get_asset_thumbnails(id)
38
+ # return @client.raw("get", "/content/assets/thumbnails/#{id}")
39
+ #end
40
+
41
+ # === Get asset usage.
42
+ # Get usage of an asset.
43
+ #
44
+ # ==== Parameters
45
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
46
+ def get_asset_usage(options) #get, le mandas el asset id para saber donde lo has puesto
47
+ return @client.raw("get", "/content/assets/usage", options)
48
+ end
49
+
50
+ # === Get asset info.
51
+ # Get info of an asset.
52
+ #TODO: Research if is an asset or many assets
53
+ #
54
+ # ==== Parameters
55
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
56
+ def get_asset_info(options)
57
+ return @client.raw("get", "/content/assets/getAssetInfo", options)
58
+ end
59
+
60
+ # === Get asset doc types.
61
+ # Get doc types of assets.
62
+ def get_asset_doc_types
63
+ return @client.raw("get", "/content/assets/docTypes")
64
+ end
65
+
66
+ # === Get asset public route.
67
+ # Get public route of assets.
68
+ def get_asset_public_route
69
+ return @client.raw("get", "/content/assets/publicRoute")
70
+ end
71
+
72
+ # === Upload asset.
73
+ # Upload an asset. It can be images, documents and videos.
74
+ #
75
+ # ==== Parameters
76
+ # data:: (Hash) -- Data to be submited.
77
+ #
78
+ # ==== First Example (with files)
79
+ #
80
+ #
81
+ # ==== Second Example (with urls)
82
+ # data = {
83
+ # "title": "asset title",
84
+ # "description": "asset description",
85
+ # "link": "https://link/example",
86
+ # "url-type": "url-image",
87
+ # "slug": "slug",
88
+ # "type": "link",
89
+ # "father_id": 1
90
+ # }
91
+ # @data = @mints_user.upload_asset(data.to_json)
92
+ #
93
+ # ==== Third Example (with video)
94
+ # data = {
95
+ # "title": "Video Title",
96
+ # "fileType": "video/mp4",
97
+ # "type": "video",
98
+ # "slug": "video-slug",
99
+ # "status": "not-uploaded",
100
+ # "ext": "mp4",
101
+ # "size": 29605264,
102
+ # "access_token": "access_token",
103
+ # "name": "Video Title",
104
+ # "videoData": {
105
+ # "id": 80313307,
106
+ # "name": "Video Title",
107
+ # "type": "video",
108
+ # "created": "2021-10-19T19:18:17+00:00",
109
+ # "updated": "2021-10-19T19:18:17+00:00",
110
+ # "duration": 191.936133,
111
+ # "hashed_id": "hashed_id",
112
+ # "progress": 0.14285714285714285,
113
+ # "status": "queued",
114
+ # "thumbnail": {
115
+ # "url": "https://www.example.com/img/img.jpg",
116
+ # "width": 200,
117
+ # "height": 120
118
+ # },
119
+ # "account_id": 1234567
120
+ # }
121
+ # }
122
+ # @data = @mints_user.upload_asset(data.to_json)
123
+ def upload_asset(data) #TODO: Research a way to upload a File accross sdk
124
+ return @client.raw("post", "/content/assets/upload", nil, data)
125
+ end
126
+
127
+
128
+ ##
129
+ # == Sizes
130
+ #
131
+
132
+
133
+ #FIXME: Double get asset sizes method!
134
+ # === Get asset sizes.
135
+ # Get a collection of sizes of an asset.
136
+ #
137
+ # ==== Parameters
138
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
139
+ def get_asset_sizes(options)
140
+ return @client.raw("get", "/content/assets/getSizes", options)
141
+ end
142
+
143
+ # === Get asset sizes.
144
+ # Get sizes of an asset.
145
+ #
146
+ # ==== Parameters
147
+ # id:: (Integer) Asset id.
148
+ #
149
+ # ==== Example
150
+ # @data = @mints_user.get_asset_sizes(2)
151
+ def get_asset_sizes(id) #FIXME: wrong number of arguments (given 1, expected 0)
152
+ return @client.raw("get", "/content/assets/sizes/#{id}")
153
+ end
154
+
155
+ # === Create asset size.
156
+ # Create an asset size by data.
157
+ #
158
+ # ==== Parameters
159
+ # data:: (Hash) -- Data to be submited.
160
+ #
161
+ # ==== Example
162
+ # data = {
163
+ # "aspectRadio": "custom",
164
+ # "assetId": 23,
165
+ # "drawPosData": {
166
+ # "pos": {
167
+ # "sx": 100,
168
+ # "sy": 100,
169
+ # "swidth": 200,
170
+ # "sheight": 200
171
+ # }
172
+ # },
173
+ # "width": 100,
174
+ # "height": 100,
175
+ # "slug": "fuji_size_slug",
176
+ # "title": "fuji_size",
177
+ # "variationId": "original"
178
+ # }
179
+ # @data = @mints_user.create_asset_size(data.to_json)
180
+ def create_asset_size(data)
181
+ return @client.raw("post", "/content/assets/createSize", nil, data)
182
+ end
183
+
184
+ # === Edit asset size.
185
+ # Edit an asset size.
186
+ #
187
+ # ==== Parameters
188
+ # data:: (Hash) -- Data to be submited.
189
+ def edit_asset_size(data) #TODO: Not tested
190
+ return @client.raw("post", "/content/assets/editSize", nil, data)
191
+ end
192
+
193
+ # === Delete asset size.
194
+ def delete_asset_size #TODO: Not tested
195
+ return @client.raw("get", "/content/assets/deleteSize") #DELETE OR GET?
196
+ end
197
+
198
+
199
+ ##
200
+ # == Variations
201
+ #
202
+
203
+
204
+ # === Get asset variation.
205
+ # Get variation of an asset.
206
+ #
207
+ # ==== Parameters
208
+ # id:: (Integer) Asset variation id. #TODO: Research if is an asset id or an variation id
209
+ #
210
+ # ==== Example
211
+ # @data = @mints_user.get_asset_sizes(2)
212
+ def get_asset_variation(id)
213
+ #FIXME: Id 1 and 4: Trying to get property 'path' of non-object maybe json convertion is bad
214
+ #FIXME: Id 2 and 3: File not found at path maybe doesnt exist
215
+ return @client.raw("get", "/content/assets/variation/#{id}")
216
+ end
217
+
218
+ # === Generate asset variation.
219
+ # Create an asset variation of an existing asset.
220
+ #
221
+ # ==== Parameters
222
+ # data:: (Hash) -- Data to be submited.
223
+ def generate_asset_variation(data) #FIXME: Trying to get property 'width' of non-object
224
+ return @client.raw("post", "/content/assets/generateAssetVariations", nil, data)
225
+ end
226
+
227
+ # === Upload asset variation.
228
+ #
229
+ # ==== Parameters
230
+ # data:: (Hash) -- Data to be submited.
231
+ def upload_asset_variation(data) #FIXME: Call to a member function guessClientExtension() on null
232
+ return @client.raw("post", "/content/assets/uploadVariation", nil, data)
233
+ end
234
+
235
+ # === Update asset variation.
236
+ #
237
+ # ==== Parameters
238
+ # data:: (Hash) -- Data to be submited.
239
+ def update_asset_variation(id, data) #TODO:
240
+ return @client.raw("post", "/content/assets/updateVariation/#{id}", nil, data)
241
+ end
242
+
243
+ # === Delete asset variation.
244
+ def delete_asset_variation #TODO: Not tested
245
+ return @client.raw("get", "/content/assets/deleteVariation") #DELETE OR GET?
246
+ end
247
+
248
+
249
+
250
+
251
+
252
+ # === Get original asset.
253
+ #
254
+ # ==== Parameters
255
+ # id:: (Integer) Asset id.
256
+ def get_original_asset(id) #FIXME: Doesn't return JSON
257
+ return @client.raw("get", "/content/assets/original/#{id}")
258
+ end
259
+
260
+ end