mints 0.0.27 → 0.0.29
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 +287 -385
- data/lib/contact/config/appointments.rb +201 -0
- data/lib/contact/config/config.rb +7 -0
- data/lib/contact/content/content.rb +7 -0
- data/lib/contact/content/conversations.rb +121 -0
- data/lib/contact/ecommerce/ecommerce.rb +12 -0
- data/lib/contact/ecommerce/order_items.rb +19 -0
- data/lib/contact/ecommerce/order_items_groups.rb +95 -0
- data/lib/contact/ecommerce/orders.rb +133 -0
- data/lib/contact.rb +57 -607
- data/lib/errors.rb +4 -2
- data/lib/generators/mints_assets_controller.rb +4 -1
- data/lib/generators/mints_config.yml.erb +0 -2
- data/lib/generators/mints_contact_controller.rb +4 -1
- data/lib/generators/mints_files_generator.rb +16 -13
- data/lib/generators/mints_link.rb +9 -6
- data/lib/generators/mints_public_controller.rb +4 -1
- data/lib/generators/mints_user_controller.rb +3 -0
- data/lib/generators/short_link_controller.rb +4 -1
- data/lib/mints/controllers/admin_base_controller.rb +5 -3
- data/lib/mints/controllers/base_api_controller.rb +6 -4
- data/lib/mints/controllers/base_controller.rb +5 -3
- data/lib/mints/controllers/concerns/mints_clients.rb +4 -2
- data/lib/mints/controllers/concerns/read_config_file.rb +3 -1
- data/lib/mints/controllers/contact_api_controller.rb +12 -10
- data/lib/mints/controllers/public_api_controller.rb +10 -8
- data/lib/mints/controllers/user_api_controller.rb +11 -9
- data/lib/mints/helpers/contact_auth_helper.rb +3 -1
- data/lib/mints/helpers/mints_helper.rb +39 -38
- data/lib/mints/helpers/proxy_controllers_methods.rb +24 -24
- data/lib/mints/helpers/user_auth_helper.rb +5 -3
- data/lib/mints.rb +12 -10
- data/lib/pub.rb +75 -93
- data/lib/user/config/api_keys.rb +63 -61
- data/lib/user/config/appointments.rb +217 -215
- data/lib/user/config/attribute_groups.rb +74 -72
- data/lib/user/config/attributes.rb +83 -81
- data/lib/user/config/calendars.rb +88 -86
- data/lib/user/config/config.rb +31 -63
- data/lib/user/config/public_folders.rb +105 -104
- data/lib/user/config/relationships.rb +135 -132
- data/lib/user/config/roles.rb +76 -79
- data/lib/user/config/seeds.rb +52 -51
- data/lib/user/config/system_settings.rb +50 -49
- data/lib/user/config/tags.rb +57 -59
- data/lib/user/config/taxonomies.rb +115 -119
- data/lib/user/config/teams.rb +69 -68
- data/lib/user/config/users.rb +72 -71
- data/lib/user/contacts/contacts.rb +21 -20
- data/lib/user/content/assets.rb +275 -280
- data/lib/user/content/content.rb +236 -235
- data/lib/user/content/content_instances.rb +138 -138
- data/lib/user/content/content_templates.rb +105 -103
- data/lib/user/content/conversations.rb +195 -193
- data/lib/user/content/dam.rb +85 -80
- data/lib/user/content/forms.rb +231 -233
- data/lib/user/content/message_templates.rb +154 -151
- data/lib/user/content/messages.rb +89 -87
- data/lib/user/content/pages.rb +84 -82
- data/lib/user/content/stories.rb +101 -101
- data/lib/user/content/story_templates.rb +90 -88
- data/lib/user/content/story_versions.rb +117 -117
- data/lib/user/crm/companies.rb +106 -106
- data/lib/user/crm/contacts.rb +287 -292
- data/lib/user/crm/crm.rb +21 -19
- data/lib/user/crm/deals.rb +105 -103
- data/lib/user/crm/favorites.rb +16 -13
- data/lib/user/crm/segments.rb +123 -123
- data/lib/user/crm/users.rb +22 -20
- data/lib/user/crm/workflow_step_objects.rb +86 -84
- data/lib/user/crm/workflow_steps.rb +47 -45
- data/lib/user/crm/workflows.rb +67 -65
- data/lib/user/ecommerce/ecommerce.rb +29 -27
- data/lib/user/ecommerce/item_prices.rb +84 -81
- data/lib/user/ecommerce/locations.rb +162 -160
- data/lib/user/ecommerce/order_items_groups.rb +110 -106
- data/lib/user/ecommerce/order_statuses.rb +26 -24
- data/lib/user/ecommerce/orders.rb +253 -246
- data/lib/user/ecommerce/price_lists.rb +70 -68
- data/lib/user/ecommerce/product_templates.rb +101 -99
- data/lib/user/ecommerce/product_variations.rb +124 -120
- data/lib/user/ecommerce/products.rb +162 -159
- data/lib/user/ecommerce/skus.rb +87 -85
- data/lib/user/ecommerce/taxes.rb +81 -79
- data/lib/user/ecommerce/variant_options.rb +68 -66
- data/lib/user/ecommerce/variant_values.rb +71 -69
- data/lib/user/helpers/helpers.rb +104 -101
- data/lib/user/helpers/object_activities.rb +80 -78
- data/lib/user/helpers/object_folders.rb +78 -76
- data/lib/user/helpers/user_folders.rb +79 -77
- data/lib/user/marketing/marketing.rb +116 -113
- data/lib/user/profile/profile.rb +96 -103
- data/lib/user.rb +32 -41
- metadata +50 -43
- data/lib/user/config/importers.rb +0 -184
data/lib/pub.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'yaml'
|
|
2
|
-
require_relative './client
|
|
3
|
-
require_relative './mints/helpers/mints_helper
|
|
4
|
+
require_relative './client'
|
|
5
|
+
require_relative './mints/helpers/mints_helper'
|
|
4
6
|
|
|
5
7
|
module Mints
|
|
6
8
|
##
|
|
@@ -22,17 +24,17 @@ module Mints
|
|
|
22
24
|
# { "include": "events" }
|
|
23
25
|
# * +attributes+ - [_Boolean_] If present, attributes will be returned for each record in the results. _Example:_
|
|
24
26
|
# { "attributes": true }
|
|
25
|
-
# * +
|
|
26
|
-
# { "
|
|
27
|
+
# * +taxonomies+ - [_Boolean_] If present, taxonomies will be returned for each record in the results. _Example:_
|
|
28
|
+
# { "taxonomies": true }
|
|
27
29
|
# * +tags+ - [_Boolean_] If present, tags will be returned for each record in the results. _Example:_
|
|
28
30
|
# { "tags": true }
|
|
29
31
|
# * +fields+ - [_String_] Specify the fields that you want to be returned. If empty, all fields are returned. The object index can also be used to specify specific fields from relations. _Example:_
|
|
30
|
-
# {
|
|
32
|
+
# { fields: "id, title, slug" }
|
|
31
33
|
# { "fields[products]": "id, title, slug" }
|
|
32
34
|
#
|
|
33
35
|
# == Resource collections options
|
|
34
36
|
# * +search+ - [_String_] If present, it will search for records matching the search string. _Example:_
|
|
35
|
-
# { "search": "
|
|
37
|
+
# { "search": "search string" }
|
|
36
38
|
# * +scopes+ - [_String_] If present, it will apply the specified Model's scopes. _Example:_
|
|
37
39
|
# { "scopes": "approved, recent" }
|
|
38
40
|
# * +filters+ - [_String_] This is a powerful parameter that allows the data to be filtered by any of its fields. Currently only exact matches are supported. _Example:_
|
|
@@ -44,34 +46,22 @@ module Mints
|
|
|
44
46
|
# {
|
|
45
47
|
# "type":"attribute",
|
|
46
48
|
# "operator":"==",
|
|
47
|
-
#
|
|
49
|
+
# slug:"title",
|
|
48
50
|
# "value":"Action movies"
|
|
49
51
|
# }
|
|
50
52
|
# ],
|
|
51
53
|
# "operator":"or"
|
|
52
54
|
# }
|
|
53
55
|
# options = { "jfilters": jfilter }
|
|
54
|
-
# * +catfilters+ - [_String_] filter by categories. _Example:_
|
|
55
|
-
# { "catfilters": "categoryName" }
|
|
56
|
-
# * +fields+ - [_String_] Specify the fields that you want to be returned. If empty, all fields are returned. The object index can also be used to specify specific fields from relations. _Example:_
|
|
57
|
-
# { "fields": "id, title, slug" }
|
|
58
|
-
# { "fields[products]": "id, title, slug" }
|
|
59
56
|
# * +sort+ - [_String_] The name of the field to perform the sort. Prefix the value with a minus sign - for ascending order. _Example:_
|
|
60
|
-
# {
|
|
61
|
-
# {
|
|
62
|
-
# * +include+ - [_String_] Specify additional information to be included in the results from the objects relations. _Example:_
|
|
63
|
-
# { "include": "events" }
|
|
64
|
-
# * +attributes+ - [_Boolean_] If present, attributes will be returned for each record in the results. _Example:_
|
|
65
|
-
# { "attributes": true }
|
|
66
|
-
# * +categories+ - [_Boolean_] If present, categories will be returned for each record in the results. _Example:_
|
|
67
|
-
# { "categories": true }
|
|
68
|
-
# * +taxonomies+ - [_Boolean_] If present, taxonomies will be returned for each record in the results. _Example:_
|
|
69
|
-
# { "taxonomies": true }
|
|
70
|
-
# * +tags+ - [_Boolean_] If present, tags will be returned for each record in the results. _Example:_
|
|
71
|
-
# { "tags": true }
|
|
57
|
+
# { sort: "title" }
|
|
58
|
+
# { sort: "-title" }
|
|
72
59
|
|
|
73
60
|
class Pub
|
|
74
61
|
attr_reader :client
|
|
62
|
+
|
|
63
|
+
include MintsHelper
|
|
64
|
+
|
|
75
65
|
##
|
|
76
66
|
# === Initialize.
|
|
77
67
|
# Class constructor.
|
|
@@ -110,8 +100,8 @@ module Mints
|
|
|
110
100
|
user_agent: user_agent || request.user_agent,
|
|
111
101
|
url: url || request.fullpath
|
|
112
102
|
}
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
|
|
104
|
+
@client.raw('post', '/register-visit', nil, data.to_json)
|
|
115
105
|
end
|
|
116
106
|
|
|
117
107
|
##
|
|
@@ -125,7 +115,7 @@ module Mints
|
|
|
125
115
|
# ==== Example
|
|
126
116
|
# @data = @mints_pub.register_visit_timer("60da2325d29acc7e55684472", 4)
|
|
127
117
|
def register_visit_timer(visit, time)
|
|
128
|
-
@client.raw(
|
|
118
|
+
@client.raw('get', "/register-visit-timer?visit=#{visit}&time=#{time}")
|
|
129
119
|
end
|
|
130
120
|
|
|
131
121
|
### V1/CONTENT ###
|
|
@@ -140,7 +130,7 @@ module Mints
|
|
|
140
130
|
# ==== Example
|
|
141
131
|
# @data = @mints_pub.get_asset_info("asset_slug")
|
|
142
132
|
def get_asset_info(slug)
|
|
143
|
-
@client.raw(
|
|
133
|
+
@client.raw('get', "/content/asset-info/#{slug}")
|
|
144
134
|
end
|
|
145
135
|
|
|
146
136
|
##
|
|
@@ -155,18 +145,16 @@ module Mints
|
|
|
155
145
|
# @data = @mints_pub.get_stories
|
|
156
146
|
#
|
|
157
147
|
# ==== Second Example
|
|
158
|
-
# options = {
|
|
159
|
-
# "fields": "id, slug"
|
|
160
|
-
# }
|
|
148
|
+
# options = { fields: 'id, slug' }
|
|
161
149
|
# @data = @mints_pub.get_stories(options)
|
|
162
150
|
#
|
|
163
151
|
# ==== Third Example
|
|
164
152
|
# options = {
|
|
165
|
-
#
|
|
153
|
+
# fields: 'id, slug'
|
|
166
154
|
# }
|
|
167
155
|
# @data = @mints_pub.get_stories(options, false)
|
|
168
156
|
def get_stories(options = nil, use_post = true)
|
|
169
|
-
|
|
157
|
+
get_query_results('/content/stories', options, use_post)
|
|
170
158
|
end
|
|
171
159
|
|
|
172
160
|
##
|
|
@@ -183,7 +171,7 @@ module Mints
|
|
|
183
171
|
# ==== Second Example
|
|
184
172
|
# @data = @mints_pub.get_story("story_slug", options.to_json)
|
|
185
173
|
def get_story(slug, options = nil)
|
|
186
|
-
@client.raw(
|
|
174
|
+
@client.raw('get', "/content/stories/#{slug}", options)
|
|
187
175
|
end
|
|
188
176
|
|
|
189
177
|
##
|
|
@@ -199,17 +187,17 @@ module Mints
|
|
|
199
187
|
#
|
|
200
188
|
# ==== Second Example
|
|
201
189
|
# options = {
|
|
202
|
-
#
|
|
190
|
+
# fields: 'id, title'
|
|
203
191
|
# }
|
|
204
192
|
# @data = @mints_pub.get_story_versions(options)
|
|
205
193
|
#
|
|
206
194
|
# ==== Third Example
|
|
207
195
|
# options = {
|
|
208
|
-
#
|
|
196
|
+
# fields: 'id, title'
|
|
209
197
|
# }
|
|
210
198
|
# @data = @mints_pub.get_story_versions(options, false)
|
|
211
199
|
def get_story_versions(options = nil, use_post = true)
|
|
212
|
-
|
|
200
|
+
get_query_results('/content/story-versions', options, use_post)
|
|
213
201
|
end
|
|
214
202
|
|
|
215
203
|
##
|
|
@@ -226,7 +214,7 @@ module Mints
|
|
|
226
214
|
# ==== Second Example
|
|
227
215
|
# @data = @mints_pub.get_story_version("story_slug", options.to_json)
|
|
228
216
|
def get_story_version(slug, options = nil)
|
|
229
|
-
@client.raw(
|
|
217
|
+
@client.raw('get', "/content/story-versions/#{slug}", options)
|
|
230
218
|
end
|
|
231
219
|
|
|
232
220
|
##
|
|
@@ -236,7 +224,7 @@ module Mints
|
|
|
236
224
|
# ==== Example
|
|
237
225
|
# @data = @mints_pub.get_forms
|
|
238
226
|
def get_forms(options = nil)
|
|
239
|
-
@client.raw(
|
|
227
|
+
@client.raw('get', '/content/forms', options)
|
|
240
228
|
end
|
|
241
229
|
|
|
242
230
|
##
|
|
@@ -249,7 +237,7 @@ module Mints
|
|
|
249
237
|
# ==== Example
|
|
250
238
|
# @data = @mints_pub.get_form("form_slug")
|
|
251
239
|
def get_form(slug, options = nil)
|
|
252
|
-
@client.raw(
|
|
240
|
+
@client.raw('get', "/content/forms/#{slug}", options)
|
|
253
241
|
end
|
|
254
242
|
|
|
255
243
|
##
|
|
@@ -270,7 +258,7 @@ module Mints
|
|
|
270
258
|
# }
|
|
271
259
|
# @data = @mints_pub.submit_form(data)
|
|
272
260
|
def submit_form(data)
|
|
273
|
-
@client.raw(
|
|
261
|
+
@client.raw('post', '/content/forms/submit', nil, data_transform(data))
|
|
274
262
|
end
|
|
275
263
|
|
|
276
264
|
##
|
|
@@ -289,11 +277,11 @@ module Mints
|
|
|
289
277
|
# ==== Second Example
|
|
290
278
|
# options = {
|
|
291
279
|
# "template": "content_instance_template_slug",
|
|
292
|
-
#
|
|
280
|
+
# sort: "-id"
|
|
293
281
|
# }
|
|
294
282
|
# @data = @mints_pub.get_content_instances(options)
|
|
295
|
-
def get_content_instances(options)
|
|
296
|
-
@client.raw(
|
|
283
|
+
def get_content_instances(options = nil)
|
|
284
|
+
@client.raw('get', '/content/content-instances', options)
|
|
297
285
|
end
|
|
298
286
|
|
|
299
287
|
##
|
|
@@ -306,19 +294,18 @@ module Mints
|
|
|
306
294
|
# ==== Example
|
|
307
295
|
# @data = @mints_pub.get_content_instance("content_instance_slug")
|
|
308
296
|
def get_content_instance(slug)
|
|
309
|
-
@client.raw(
|
|
297
|
+
@client.raw('get', "/content/content-instances/#{slug}")
|
|
310
298
|
end
|
|
311
299
|
|
|
312
|
-
#Note: This method is commented for future use
|
|
313
300
|
##
|
|
314
301
|
# === Get Content Pages.
|
|
315
302
|
# Get all content pages.
|
|
316
303
|
#
|
|
317
304
|
# ==== Parameters
|
|
318
305
|
# options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
306
|
+
def get_content_bundles(options = nil)
|
|
307
|
+
@client.raw('get', '/content/content-bundles', options)
|
|
308
|
+
end
|
|
322
309
|
|
|
323
310
|
##
|
|
324
311
|
# === Get Content Page.
|
|
@@ -330,7 +317,8 @@ module Mints
|
|
|
330
317
|
# ==== Example
|
|
331
318
|
# @data = @mints_pub.get_content_page("test-page")
|
|
332
319
|
def get_content_page(slug, options = nil)
|
|
333
|
-
|
|
320
|
+
warn '[DEPRECATED] The get_content_page method is deprecated and will be removed in the future, use get_content_bundle instead'
|
|
321
|
+
@client.raw('get', "/content/content-pages/#{slug}", options)
|
|
334
322
|
end
|
|
335
323
|
|
|
336
324
|
##
|
|
@@ -341,9 +329,9 @@ module Mints
|
|
|
341
329
|
# slug:: (String) -- It's the string identifier generated by Mints.
|
|
342
330
|
#
|
|
343
331
|
# ==== Example
|
|
344
|
-
# @data = @mints_pub.
|
|
332
|
+
# @data = @mints_pub.get_content_bundle("test-page")
|
|
345
333
|
def get_content_bundle(slug, options = nil)
|
|
346
|
-
@client.raw(
|
|
334
|
+
@client.raw('get', "/content/content-bundles/#{slug}", options)
|
|
347
335
|
end
|
|
348
336
|
|
|
349
337
|
### V1/ECOMMERCE ###
|
|
@@ -360,14 +348,14 @@ module Mints
|
|
|
360
348
|
# @data = @mints_pub.get_locations
|
|
361
349
|
#
|
|
362
350
|
# ==== Second Example
|
|
363
|
-
# options = {
|
|
351
|
+
# options = { fields: "title" }
|
|
364
352
|
# @data = @mints_pub.get_locations(options)
|
|
365
353
|
#
|
|
366
354
|
# ==== Third Example
|
|
367
|
-
# options = {
|
|
355
|
+
# options = { fields: "title" }
|
|
368
356
|
# @data = @mints_pub.get_locations(options, false)
|
|
369
357
|
def get_locations(options = nil, use_post = true)
|
|
370
|
-
|
|
358
|
+
get_query_results('/ecommerce/locations', options, use_post)
|
|
371
359
|
end
|
|
372
360
|
|
|
373
361
|
##
|
|
@@ -382,14 +370,14 @@ module Mints
|
|
|
382
370
|
# @data = @mints_pub.get_products
|
|
383
371
|
#
|
|
384
372
|
# ==== Second Example
|
|
385
|
-
# options = {
|
|
373
|
+
# options = { fields: "title" }
|
|
386
374
|
# @data = @mints_pub.get_products(options)
|
|
387
375
|
#
|
|
388
376
|
# ==== Third Example
|
|
389
|
-
# options = {
|
|
377
|
+
# options = { fields: "title" }
|
|
390
378
|
# @data = @mints_pub.get_products(options, false)
|
|
391
379
|
def get_products(options = nil, use_post = true)
|
|
392
|
-
|
|
380
|
+
get_query_results('/ecommerce/products', options, use_post)
|
|
393
381
|
end
|
|
394
382
|
|
|
395
383
|
##
|
|
@@ -405,11 +393,11 @@ module Mints
|
|
|
405
393
|
#
|
|
406
394
|
# ==== Second Example
|
|
407
395
|
# options = {
|
|
408
|
-
#
|
|
396
|
+
# fields: 'id, slug'
|
|
409
397
|
# }
|
|
410
398
|
# @data = @mints_pub.get_product("lego-set", options)
|
|
411
399
|
def get_product(slug, options = nil)
|
|
412
|
-
@client.raw(
|
|
400
|
+
@client.raw('get', "/ecommerce/products/#{slug}", options)
|
|
413
401
|
end
|
|
414
402
|
|
|
415
403
|
### V1/CONFIG ###
|
|
@@ -423,19 +411,19 @@ module Mints
|
|
|
423
411
|
#
|
|
424
412
|
# ==== First Example
|
|
425
413
|
# options = {
|
|
426
|
-
#
|
|
414
|
+
# object_type: "products"
|
|
427
415
|
# }
|
|
428
416
|
# @data = @mints_pub.get_public_folders(options)
|
|
429
417
|
#
|
|
430
418
|
# ==== Second Example
|
|
431
419
|
# options = {
|
|
432
|
-
#
|
|
433
|
-
#
|
|
434
|
-
#
|
|
420
|
+
# object_type: "products",
|
|
421
|
+
# fields: "id",
|
|
422
|
+
# sort: "-id"
|
|
435
423
|
# }
|
|
436
424
|
# @data = @mints_pub.get_public_folders(options)
|
|
437
|
-
def get_public_folders(options)
|
|
438
|
-
@client.raw(
|
|
425
|
+
def get_public_folders(options = nil)
|
|
426
|
+
@client.raw('get', '/config/public-folders', options)
|
|
439
427
|
end
|
|
440
428
|
|
|
441
429
|
##
|
|
@@ -448,18 +436,18 @@ module Mints
|
|
|
448
436
|
#
|
|
449
437
|
# ==== First Example
|
|
450
438
|
# options = {
|
|
451
|
-
#
|
|
439
|
+
# object_type: "products"
|
|
452
440
|
# }
|
|
453
441
|
# @data = @mints_pub.get_public_folder('yellow', options)
|
|
454
442
|
#
|
|
455
443
|
# ==== Second Example
|
|
456
444
|
# options = {
|
|
457
|
-
#
|
|
458
|
-
#
|
|
445
|
+
# object_type: "products",
|
|
446
|
+
# fields: 'id, title'
|
|
459
447
|
# }
|
|
460
448
|
# @data = @mints_pub.get_public_folder('yellow', options)
|
|
461
449
|
def get_public_folder(slug, options)
|
|
462
|
-
@client.raw(
|
|
450
|
+
@client.raw('get', "/config/public-folders/#{slug}", options)
|
|
463
451
|
end
|
|
464
452
|
|
|
465
453
|
##
|
|
@@ -474,11 +462,11 @@ module Mints
|
|
|
474
462
|
#
|
|
475
463
|
# ==== Second Example
|
|
476
464
|
# options = {
|
|
477
|
-
#
|
|
465
|
+
# fields: "id, tag"
|
|
478
466
|
# }
|
|
479
467
|
# @data = @mints_pub.get_tags(options)
|
|
480
468
|
def get_tags(options = nil)
|
|
481
|
-
@client.raw(
|
|
469
|
+
@client.raw('get', '/config/tags', options)
|
|
482
470
|
end
|
|
483
471
|
|
|
484
472
|
##
|
|
@@ -494,11 +482,11 @@ module Mints
|
|
|
494
482
|
#
|
|
495
483
|
# ==== Second Example
|
|
496
484
|
# options = {
|
|
497
|
-
#
|
|
485
|
+
# fields: "id, tag"
|
|
498
486
|
# }
|
|
499
|
-
# @data = @mints_pub.get_tag("
|
|
487
|
+
# @data = @mints_pub.get_tag("tag-example", options)
|
|
500
488
|
def get_tag(slug, options = nil)
|
|
501
|
-
@client.raw(
|
|
489
|
+
@client.raw('get', "/config/tags/#{slug}", options)
|
|
502
490
|
end
|
|
503
491
|
|
|
504
492
|
##
|
|
@@ -514,17 +502,17 @@ module Mints
|
|
|
514
502
|
#
|
|
515
503
|
# ==== Second Example
|
|
516
504
|
# options = {
|
|
517
|
-
#
|
|
505
|
+
# fields: 'id, title'
|
|
518
506
|
# }
|
|
519
507
|
# @data = @mints_pub.get_taxonomies(options)
|
|
520
508
|
#
|
|
521
509
|
# ==== Third Example
|
|
522
510
|
# options = {
|
|
523
|
-
#
|
|
511
|
+
# fields: 'id, title'
|
|
524
512
|
# }
|
|
525
513
|
# @data = @mints_pub.get_taxonomies(options, false)
|
|
526
514
|
def get_taxonomies(options = nil, use_post = true)
|
|
527
|
-
|
|
515
|
+
get_query_results('/config/taxonomies', options, use_post)
|
|
528
516
|
end
|
|
529
517
|
|
|
530
518
|
##
|
|
@@ -536,15 +524,15 @@ module Mints
|
|
|
536
524
|
# options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
|
|
537
525
|
#
|
|
538
526
|
# ==== First Example
|
|
539
|
-
# @data = @mints_pub.get_taxonomy(
|
|
527
|
+
# @data = @mints_pub.get_taxonomy('taxonomy_slug')
|
|
540
528
|
#
|
|
541
529
|
# ==== Second Example
|
|
542
530
|
# options = {
|
|
543
|
-
#
|
|
531
|
+
# fields: 'title'
|
|
544
532
|
# }
|
|
545
|
-
# @data = @mints_pub.get_taxonomy(
|
|
533
|
+
# @data = @mints_pub.get_taxonomy('taxonomy_slug', options)
|
|
546
534
|
def get_taxonomy(slug, options = nil)
|
|
547
|
-
@client.raw(
|
|
535
|
+
@client.raw('get', "/config/taxonomies/#{slug}", options)
|
|
548
536
|
end
|
|
549
537
|
|
|
550
538
|
##
|
|
@@ -554,7 +542,7 @@ module Mints
|
|
|
554
542
|
# ==== Example
|
|
555
543
|
# @data = @mints_pub.get_attributes
|
|
556
544
|
def get_attributes
|
|
557
|
-
@client.raw(
|
|
545
|
+
@client.raw('get', '/config/attributes')
|
|
558
546
|
end
|
|
559
547
|
|
|
560
548
|
def send_user_magic_link(email_or_phone, template_slug, redirect_url = '', life_time = 1440, max_visits = nil, driver = 'email')
|
|
@@ -565,16 +553,10 @@ module Mints
|
|
|
565
553
|
redirectUrl: redirect_url,
|
|
566
554
|
templateId: template_slug
|
|
567
555
|
}
|
|
568
|
-
if driver === 'sms' or driver === 'whatsapp'
|
|
569
|
-
data['phone'] = email_or_phone
|
|
570
|
-
else
|
|
571
|
-
data['email'] = email_or_phone
|
|
572
|
-
end
|
|
573
|
-
@client.raw("post", "/users/magic-link", nil, { data: data }.to_json, '/api/v1')
|
|
574
|
-
end
|
|
575
556
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
557
|
+
key = %w[sms whatsapp].include? driver ? 'phone' : 'email'
|
|
558
|
+
data[key] = email_or_phone
|
|
559
|
+
@client.raw('post', '/users/magic-link', nil, { data: data }.to_json, '/api/v1')
|
|
560
|
+
end
|
|
579
561
|
end
|
|
580
562
|
end
|
data/lib/user/config/api_keys.rb
CHANGED
|
@@ -1,65 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ApiKeys
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
##
|
|
5
|
+
# == Api keys
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# === Get api keys.
|
|
9
|
+
# Get a collection of api keys.
|
|
10
|
+
#
|
|
11
|
+
# ==== Parameters
|
|
12
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
13
|
+
#
|
|
14
|
+
# ==== First Example
|
|
15
|
+
# @data = @mints_user.get_api_keys
|
|
16
|
+
#
|
|
17
|
+
# ==== Second Example
|
|
18
|
+
# options = { fields: 'id' }
|
|
19
|
+
# @data = @mints_user.get_api_keys(options)
|
|
20
|
+
def get_api_keys(options = nil)
|
|
21
|
+
@client.raw('get', '/config/api-keys', options)
|
|
22
|
+
end
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
# === Get api key.
|
|
25
|
+
# Get an api key info.
|
|
26
|
+
#
|
|
27
|
+
# ==== Parameters
|
|
28
|
+
# id:: (Integer) -- Api key id.
|
|
29
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
30
|
+
#
|
|
31
|
+
# ==== First Example
|
|
32
|
+
# @data = @mints_user.get_api_key(2)
|
|
33
|
+
#
|
|
34
|
+
# ==== Second Example
|
|
35
|
+
# options = { fields: 'id' }
|
|
36
|
+
# @data = @mints_user.get_api_key(2, options)
|
|
37
|
+
def get_api_key(id, options = nil)
|
|
38
|
+
@client.raw('get', "/config/api-keys/#{id}", options)
|
|
39
|
+
end
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
# === Create api key.
|
|
42
|
+
# Create an api key with data.
|
|
43
|
+
#
|
|
44
|
+
# ==== Parameters
|
|
45
|
+
# data:: (Hash) -- Data to be submitted.
|
|
46
|
+
#
|
|
47
|
+
# ==== Example
|
|
48
|
+
# data = {
|
|
49
|
+
# description: 'New Api Key Description'
|
|
50
|
+
# }
|
|
51
|
+
# @data = @mints_user.create_api_key(data)
|
|
52
|
+
def create_api_key(data)
|
|
53
|
+
@client.raw('post', '/config/api-keys', nil, data_transform(data))
|
|
54
|
+
end
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
end
|
|
56
|
+
# === Delete api key.
|
|
57
|
+
# Delete an api key.
|
|
58
|
+
#
|
|
59
|
+
# ==== Parameters
|
|
60
|
+
# id:: (Integer) -- Api key id.
|
|
61
|
+
#
|
|
62
|
+
# ==== Example
|
|
63
|
+
# @data = @mints_user.delete_api_key(2)
|
|
64
|
+
def delete_api_key(id)
|
|
65
|
+
@client.raw('delete', "/config/api-keys/#{id}")
|
|
66
|
+
end
|
|
67
|
+
end
|