mints 0.0.23 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/client.rb +48 -42
  3. data/lib/contact.rb +35 -31
  4. data/lib/mints_helper.rb +2 -2
  5. data/lib/pub.rb +82 -44
  6. data/lib/user/config/api_keys.rb +1 -1
  7. data/lib/user/config/appointments.rb +10 -10
  8. data/lib/user/config/attribute_groups.rb +2 -2
  9. data/lib/user/config/attributes.rb +2 -2
  10. data/lib/user/config/calendars.rb +2 -2
  11. data/lib/user/config/importers.rb +5 -5
  12. data/lib/user/config/public_folders.rb +5 -5
  13. data/lib/user/config/relationships.rb +7 -7
  14. data/lib/user/config/roles.rb +3 -3
  15. data/lib/user/config/seeds.rb +42 -2
  16. data/lib/user/config/system_settings.rb +1 -1
  17. data/lib/user/config/tags.rb +2 -2
  18. data/lib/user/config/taxonomies.rb +7 -7
  19. data/lib/user/config/teams.rb +2 -2
  20. data/lib/user/config/users.rb +2 -2
  21. data/lib/user/contacts/contacts.rb +1 -1
  22. data/lib/user/content/assets.rb +97 -58
  23. data/lib/user/content/content.rb +8 -6
  24. data/lib/user/content/content_instances.rb +5 -5
  25. data/lib/user/content/content_templates.rb +2 -2
  26. data/lib/user/content/conversations.rb +43 -11
  27. data/lib/user/content/dam.rb +3 -3
  28. data/lib/user/content/forms.rb +70 -4
  29. data/lib/user/content/message_templates.rb +5 -5
  30. data/lib/user/content/messages.rb +2 -2
  31. data/lib/user/content/pages.rb +13 -4
  32. data/lib/user/content/stories.rb +9 -66
  33. data/lib/user/content/story_templates.rb +2 -2
  34. data/lib/user/content/story_versions.rb +124 -0
  35. data/lib/user/crm/companies.rb +7 -7
  36. data/lib/user/crm/contacts.rb +11 -11
  37. data/lib/user/crm/deals.rb +6 -6
  38. data/lib/user/crm/segments.rb +3 -3
  39. data/lib/user/crm/workflow_step_objects.rb +2 -2
  40. data/lib/user/crm/workflow_steps.rb +2 -2
  41. data/lib/user/crm/workflows.rb +2 -2
  42. data/lib/user/ecommerce/item_prices.rb +2 -2
  43. data/lib/user/ecommerce/locations.rb +15 -12
  44. data/lib/user/ecommerce/order_items_groups.rb +2 -2
  45. data/lib/user/ecommerce/orders.rb +10 -10
  46. data/lib/user/ecommerce/price_lists.rb +2 -2
  47. data/lib/user/ecommerce/product_templates.rb +2 -2
  48. data/lib/user/ecommerce/product_variations.rb +4 -4
  49. data/lib/user/ecommerce/products.rb +9 -9
  50. data/lib/user/ecommerce/skus.rb +2 -2
  51. data/lib/user/ecommerce/taxes.rb +2 -2
  52. data/lib/user/ecommerce/variant_options.rb +2 -2
  53. data/lib/user/ecommerce/variant_values.rb +2 -2
  54. data/lib/user/helpers/helpers.rb +1 -1
  55. data/lib/user/helpers/object_activities.rb +2 -2
  56. data/lib/user/helpers/object_folders.rb +2 -2
  57. data/lib/user/helpers/user_folders.rb +2 -2
  58. data/lib/user/marketing/marketing.rb +3 -3
  59. data/lib/user/profile/profile.rb +5 -5
  60. metadata +20 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d71005d83085eec4a71aeeb68e1e83604aad1bdb2c9d6d9670e26d80833c968a
4
- data.tar.gz: 6f469fe73f04248e1b227599d20273ea3de7f78555383b541cb18c1aec42ef03
3
+ metadata.gz: 669d11338b95147afd994677e57df8df3664ca41db97d1531f6d3fda3589f79f
4
+ data.tar.gz: 6b41b7f19d801fcb3f9214542959689b717ce860d779f9c23fb6c6bbe2f42a61
5
5
  SHA512:
6
- metadata.gz: 1dd19261bd09205152b353ec7770a82d20bea5e13bd5a75b938d6685de21c4fce334101249ee2d2f7a91d2a626cc1b980704dfe015cb83bd510407d3fe8bf9b6
7
- data.tar.gz: 33c6fbbfdf46ca5b1fd330a80d05ff3efceb70ebe2406b6d943e19dc3b40c31953d86a8d20d9339eea44a3a0972f1f8169034ac000256c5c5664f618e2bf21eb
6
+ metadata.gz: 6baebd5f78812bc3f58978e7449c31fa2b1b06800bb0600d87348c06954522e009440bb79d9e814117175fc021a2d44eeb6d97243b54565d243779529f86ac1c
7
+ data.tar.gz: 3704c229a2604519d09c4a4462b3a708aec04ded7ad76e6596b9753003a30e0008a865fc5eddd31160f2f3fd8d71474db4a9cb2715c1ba293ec60bc9e288162a
data/lib/client.rb CHANGED
@@ -61,14 +61,7 @@ module Mints
61
61
  if only_tracking
62
62
  headers = {"Only-Tracking" => "true"}
63
63
  #when is already in redis notify to California to register the object usage
64
- cali_response = self.send("#{@scope}_#{action}", "#{full_url}", headers, compatibility_options)
65
- if @debug
66
- puts "CALI TRACKING RESPONSE: #{cali_response}"
67
- end
68
- end
69
-
70
- if @debug
71
- puts "REDIS RESPONSE: #{redis_response}"
64
+ #cali_response = self.send("#{@scope}_#{action}", "#{full_url}", headers, compatibility_options)
72
65
  end
73
66
  else
74
67
  response = self.send("#{@scope}_#{action}", "#{full_url}", nil, compatibility_options)
@@ -95,13 +88,26 @@ module Mints
95
88
  action = 'delete'
96
89
  response = self.send("#{@scope}_#{action}", "#{full_url}", data, compatibility_options)
97
90
  end
91
+
98
92
  begin
99
93
  if result_from_cache
94
+ if @debug
95
+ puts "Method: #{action} \nURL: #{url} \nOptions: #{options.to_json} \nOnly tracking: #{only_tracking} \nResponse from: REDIS"
96
+ if (data)
97
+ puts "Data: #{data.to_json}"
98
+ end
99
+ end
100
100
  return JSON.parse(response)
101
101
  else
102
102
  if (response.response.code == "404")
103
103
  raise 'NotFoundError'
104
104
  end
105
+ if @debug
106
+ puts "Method: #{action} \nURL: #{url} \nOptions: #{options.to_json} \nOnly tracking: #{only_tracking} \nResponse from: CALI"
107
+ if (data)
108
+ puts "Data: #{data.to_json}"
109
+ end
110
+ end
105
111
  return JSON.parse(response.body)
106
112
  end
107
113
  rescue
@@ -207,55 +213,55 @@ module Mints
207
213
  ##### HTTTP CLIENTS ######
208
214
  # Simple HTTP GET
209
215
  def http_get(url, headers = nil)
210
- if @debug
211
- puts "Url:"
212
- puts url
213
- puts "Headers:"
214
- puts headers
215
- puts "Method: get"
216
- end
216
+ # if @debug
217
+ # puts "Url:"
218
+ # puts url
219
+ # puts "Headers:"
220
+ # puts headers
221
+ # puts "Method: get"
222
+ # end
217
223
  return headers ? HTTParty.get(url, :headers => headers) : HTTParty.get(url)
218
224
  end
219
225
 
220
226
  # Simple HTTP POST
221
227
  def http_post(url, headers = nil, data = nil)
222
- if @debug
223
- puts "Url:"
224
- puts url
225
- puts "Headers:"
226
- puts headers
227
- puts "Data:"
228
- puts data
229
- puts "Method: post"
230
- end
228
+ # if @debug
229
+ # puts "Url:"
230
+ # puts url
231
+ # puts "Headers:"
232
+ # puts headers
233
+ # puts "Data:"
234
+ # puts data
235
+ # puts "Method: post"
236
+ # end
231
237
  return headers ? HTTParty.post(url, :headers=> headers, :body => data) : HTTParty.post(url, :body => data)
232
238
  end
233
239
 
234
240
  # Simple HTTP PUT
235
241
  def http_put(url, headers = nil, data = nil)
236
- if @debug
237
- puts "Url:"
238
- puts url
239
- puts "Headers:"
240
- puts headers
241
- puts "Data:"
242
- puts data
243
- puts "Method: put"
244
- end
242
+ # if @debug
243
+ # puts "Url:"
244
+ # puts url
245
+ # puts "Headers:"
246
+ # puts headers
247
+ # puts "Data:"
248
+ # puts data
249
+ # puts "Method: put"
250
+ # end
245
251
  return headers ? HTTParty.put(url, :headers=> headers, :body => data) : HTTParty.put(url, :body => data)
246
252
  end
247
253
 
248
254
  # Simple HTTP DELETE
249
255
  def http_delete(url, headers = nil, data = nil)
250
- if @debug
251
- puts "Url:"
252
- puts url
253
- puts "Headers:"
254
- puts headers
255
- puts "Data:"
256
- puts data
257
- puts "Method: delete"
258
- end
256
+ # if @debug
257
+ # puts "Url:"
258
+ # puts url
259
+ # puts "Headers:"
260
+ # puts headers
261
+ # puts "Data:"
262
+ # puts data
263
+ # puts "Method: delete"
264
+ # end
259
265
  return headers ? HTTParty.delete(url, :headers=> headers, :body => data) : HTTParty.delete(url, :body => data)
260
266
  end
261
267
 
data/lib/contact.rb CHANGED
@@ -127,7 +127,7 @@ module Mints
127
127
  # Send magic link to contact by email. That magic link will be used in magic_link_login method.
128
128
  #
129
129
  # ==== Parameters
130
- # email:: (String) -- Contact's email.
130
+ # email_or_phone:: (String) -- Contact's email.
131
131
  # template_slug:: (String) -- Email template's slug to be used in the email.
132
132
  # redirectUrl:: (String) -- Url to be redirected in the implemented page.
133
133
  # lifeTime:: (Integer) -- Maximum time of use in minutes.
@@ -137,17 +137,21 @@ module Mints
137
137
  # @mints_contact.send_magic_link("email@example.com", "template_slug")
138
138
  #
139
139
  # ==== Second Example
140
- # @mints_contact.send_magic_link("email@example.com", "template_slug", "", 1440, 3)
141
- def send_magic_link(email, template_slug, redirectUrl = '', lifeTime = 1440, maxVisits = nil)
140
+ # @mints_contact.send_magic_link("+526561234567", "template_slug", "", 1440, 3, 'whatsapp')
141
+ def send_magic_link(email_or_phone, template_slug, redirect_url = '', life_time = 1440, max_visits = nil, driver = 'email')
142
142
  data = {
143
- email: email,
144
- lifeTime: lifeTime,
145
- maxVisits: maxVisits,
146
- redirectUrl: redirectUrl,
143
+ driver: driver,
144
+ lifeTime: life_time,
145
+ maxVisits: max_visits,
146
+ redirectUrl: redirect_url,
147
147
  templateId: template_slug
148
148
  }
149
- response = @client.raw("post", "/contacts/magic-link", nil, { data: data }.to_json, '/api/v1')
150
- return response
149
+ if driver === 'sms' or driver === 'whatsapp'
150
+ data['phone'] = email_or_phone
151
+ else
152
+ data['email'] = email_or_phone
153
+ end
154
+ return @client.raw("post", "/contacts/magic-link", nil, { data: data }.to_json, '/api/v1')
151
155
  end
152
156
 
153
157
  ### CONTACT/V1 ###
@@ -257,7 +261,7 @@ module Mints
257
261
  # Create a conversation with data.
258
262
  #
259
263
  # ==== Parameters
260
- # data:: (Hash) -- Data to be submited.
264
+ # data:: (Hash) -- Data to be submitted.
261
265
  #
262
266
  # ==== Example
263
267
  # data = {
@@ -274,7 +278,7 @@ module Mints
274
278
  #
275
279
  # ==== Parameters
276
280
  # id:: (Integer) -- Conversation id.
277
- # data:: (Hash) -- Data to be submited.
281
+ # data:: (Hash) -- Data to be submitted.
278
282
  # FIXME: This method doesn't locate conversation id to be updated.
279
283
  def update_conversation(id, data)
280
284
  return @client.raw("put", "/content/conversations/#{id}", nil, data_transform(data), @contact_v1_url)
@@ -286,7 +290,7 @@ module Mints
286
290
  #
287
291
  # ==== Parameters
288
292
  # id:: (Integer) -- Conversation id.
289
- # data:: (Hash) -- Data to be submited.
293
+ # data:: (Hash) -- Data to be submitted.
290
294
  # FIXME: This method doesn't locate conversation id to be updated.
291
295
  def update_conversation_status(id, data)
292
296
  return @client.raw("put", "/content/conversations/#{id}/status", nil, data_transform(data), @contact_v1_url)
@@ -332,7 +336,7 @@ module Mints
332
336
  # Create a message with data.
333
337
  #
334
338
  # ==== Parameters
335
- # data:: (Hash) -- Data to be submited.
339
+ # data:: (Hash) -- Data to be submitted.
336
340
  #
337
341
  # ==== Example
338
342
  # data = {
@@ -392,7 +396,7 @@ module Mints
392
396
  # Create an appointment with data.
393
397
  #
394
398
  # ==== Parameters
395
- # data:: (Hash) -- Data to be submited.
399
+ # data:: (Hash) -- Data to be submitted.
396
400
  #
397
401
  # ==== Example
398
402
  # data = {
@@ -413,7 +417,7 @@ module Mints
413
417
  #
414
418
  # ==== Parameters
415
419
  # id:: (Integer) -- Appointment id.
416
- # data:: (Hash) -- Data to be submited.
420
+ # data:: (Hash) -- Data to be submitted.
417
421
  #
418
422
  # ==== Example
419
423
  # data = {
@@ -429,7 +433,7 @@ module Mints
429
433
  # Get a collection of appointments filtering by object_type, object_id and dates range.
430
434
  #
431
435
  # ==== Parameters
432
- # data:: (Hash) -- Data to be submited.
436
+ # data:: (Hash) -- Data to be submitted.
433
437
  #
434
438
  # ==== Example
435
439
  # data = {
@@ -448,7 +452,7 @@ module Mints
448
452
  # Attach invitee to an appointment.
449
453
  #
450
454
  # ==== Parameters
451
- # data:: (Hash) -- Data to be submited.
455
+ # data:: (Hash) -- Data to be submitted.
452
456
  #
453
457
  # ==== Example
454
458
  # data = {
@@ -465,7 +469,7 @@ module Mints
465
469
  # Attach follower to an appointment.
466
470
  #
467
471
  # ==== Parameters
468
- # data:: (Hash) -- Data to be submited.
472
+ # data:: (Hash) -- Data to be submitted.
469
473
  #
470
474
  # ==== Example
471
475
  # data = {
@@ -482,7 +486,7 @@ module Mints
482
486
  # Detach invitee from an appointment.
483
487
  #
484
488
  # ==== Parameters
485
- # data:: (Hash) -- Data to be submited.
489
+ # data:: (Hash) -- Data to be submitted.
486
490
  #
487
491
  # ==== Example
488
492
  # data = {
@@ -499,7 +503,7 @@ module Mints
499
503
  # Detach follower from an appointment.
500
504
  #
501
505
  # ==== Parameters
502
- # data:: (Hash) -- Data to be submited.
506
+ # data:: (Hash) -- Data to be submitted.
503
507
  #
504
508
  # ==== Example
505
509
  # data = {
@@ -516,7 +520,7 @@ module Mints
516
520
  # Sync an invitee from an appointment.
517
521
  #
518
522
  # ==== Parameters
519
- # data:: (Hash) -- Data to be submited.
523
+ # data:: (Hash) -- Data to be submitted.
520
524
  #
521
525
  # ==== Example
522
526
  # data = {
@@ -533,7 +537,7 @@ module Mints
533
537
  # Sync a follower from an appointment.
534
538
  #
535
539
  # ==== Parameters
536
- # data:: (Hash) -- Data to be submited.
540
+ # data:: (Hash) -- Data to be submitted.
537
541
  #
538
542
  # ==== Example
539
543
  # data = {
@@ -596,7 +600,7 @@ module Mints
596
600
  # Create a order with data.
597
601
  #
598
602
  # ==== Parameters
599
- # data:: (Hash) -- Data to be submited.
603
+ # data:: (Hash) -- Data to be submitted.
600
604
  #
601
605
  # ==== Example
602
606
  # data = {
@@ -615,7 +619,7 @@ module Mints
615
619
  #
616
620
  # ==== Parameters
617
621
  # id:: (Integer) -- Order Id
618
- # data:: (Hash) -- Data to be submited.
622
+ # data:: (Hash) -- Data to be submitted.
619
623
  # FIXME: This method doesnt update an order.
620
624
  def update_order(id, data)
621
625
  return @client.raw("put", "/ecommerce/orders/#{id}", nil, data_transform(data), @contact_v1_url)
@@ -652,8 +656,8 @@ module Mints
652
656
  # ==== Example
653
657
  # @data = @mints_contact.get_my_shopping_cart
654
658
  # FIXME: This method returns a nil data.
655
- def get_my_shopping_cart
656
- return @client.raw("get", "/ecommerce/my-shopping-cart", nil, nil, @contact_v1_url)
659
+ def get_my_shopping_cart(options = nil)
660
+ return @client.raw("get", "/ecommerce/my-shopping-cart", options, nil, @contact_v1_url)
657
661
  end
658
662
 
659
663
  ##
@@ -661,7 +665,7 @@ module Mints
661
665
  # Add an item into a shopping cart.
662
666
  #
663
667
  # ==== Parameters
664
- # data:: (Hash) -- Data to be submited.
668
+ # data:: (Hash) -- Data to be submitted.
665
669
  #
666
670
  # ==== Example
667
671
  # data = {
@@ -670,8 +674,8 @@ module Mints
670
674
  # "price_list_id": 1
671
675
  # }
672
676
  # @data = @mints_contact.add_item_to_shopping_cart(data)
673
- def add_item_to_shopping_cart(data)
674
- return @client.raw("post", "/ecommerce/shopping-cart", nil, data_transform(data), @contact_v1_url)
677
+ def add_item_to_shopping_cart(data, options = nil)
678
+ return @client.raw("post", "/ecommerce/shopping-cart", options, data_transform(data), @contact_v1_url)
675
679
  end
676
680
 
677
681
  ##
@@ -734,7 +738,7 @@ module Mints
734
738
  # Create an order item group with data if you are related to that order.
735
739
  #
736
740
  # ==== Parameters
737
- # data:: (Hash) -- Data to be submited.
741
+ # data:: (Hash) -- Data to be submitted.
738
742
  #
739
743
  # ==== First Example
740
744
  # data = {
@@ -763,7 +767,7 @@ module Mints
763
767
  #
764
768
  # ==== Parameters
765
769
  # id:: (Integer) -- Order Item Group Id.
766
- # data:: (Hash) -- Data to be submited.
770
+ # data:: (Hash) -- Data to be submitted.
767
771
  #
768
772
  # ==== First Example
769
773
  # data = {
data/lib/mints_helper.rb CHANGED
@@ -20,7 +20,7 @@ module MintsHelper
20
20
  # Transform a 'data' variable to a standardized 'data' variable.
21
21
  #
22
22
  # ==== Parameters
23
- # data:: (Hash) -- Data to be submited.
23
+ # data:: (Hash) -- Data to be submitted.
24
24
  #
25
25
  def data_transform(data)
26
26
  data = correct_json(data)
@@ -34,7 +34,7 @@ module MintsHelper
34
34
  # Receives a json data and convert it to a symbolized object.
35
35
  #
36
36
  # ==== Parameters
37
- # data:: (Hash) -- Data to be submited.
37
+ # data:: (Hash) -- Data to be submitted.
38
38
  #
39
39
  def correct_json(data)
40
40
  if data.is_a? String
data/lib/pub.rb CHANGED
@@ -156,13 +156,13 @@ module Mints
156
156
  #
157
157
  # ==== Second Example
158
158
  # options = {
159
- # "fields": "id, title"
159
+ # "fields": "id, slug"
160
160
  # }
161
161
  # @data = @mints_pub.get_stories(options)
162
162
  #
163
163
  # ==== Third Example
164
164
  # options = {
165
- # "fields": "id, title"
165
+ # "fields": "id, slug"
166
166
  # }
167
167
  # @data = @mints_pub.get_stories(options, false)
168
168
  def get_stories(options = nil, use_post = true)
@@ -183,7 +183,50 @@ module Mints
183
183
  # ==== Second Example
184
184
  # @data = @mints_pub.get_story("story_slug", options.to_json)
185
185
  def get_story(slug, options = nil)
186
- return @client.raw("get", "/content/stories/#{slug}", options, nil, nil, nil, true)
186
+ return @client.raw("get", "/content/stories/#{slug}", options)
187
+ end
188
+
189
+ ##
190
+ # === Get Story Versions.
191
+ # Get a collection of story version.
192
+ #
193
+ # ==== Parameters
194
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
195
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
196
+ #
197
+ # ==== First Example
198
+ # @data = @mints_pub.get_story_versions
199
+ #
200
+ # ==== Second Example
201
+ # options = {
202
+ # "fields": "id, title"
203
+ # }
204
+ # @data = @mints_pub.get_story_versions(options)
205
+ #
206
+ # ==== Third Example
207
+ # options = {
208
+ # "fields": "id, title"
209
+ # }
210
+ # @data = @mints_pub.get_story_versions(options, false)
211
+ def get_story_versions(options = nil, use_post = true)
212
+ return get_query_results("/content/story-versions", options, use_post)
213
+ end
214
+
215
+ ##
216
+ # === Get Story Version.
217
+ # Get a single story version.
218
+ #
219
+ # ==== Parameters
220
+ # slug:: (String) -- It's the string identifier generated by Mints.
221
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
222
+ #
223
+ # ==== First Example
224
+ # @data = @mints_pub.get_story_version("story_slug")
225
+ #
226
+ # ==== Second Example
227
+ # @data = @mints_pub.get_story_version("story_slug", options.to_json)
228
+ def get_story_version(slug, options = nil)
229
+ return @client.raw("get", "/content/story-versions/#{slug}", options)
187
230
  end
188
231
 
189
232
  ##
@@ -192,8 +235,8 @@ module Mints
192
235
  #
193
236
  # ==== Example
194
237
  # @data = @mints_pub.get_forms
195
- def get_forms
196
- return @client.raw("get", "/content/forms")
238
+ def get_forms(options = nil)
239
+ return @client.raw("get", "/content/forms", options)
197
240
  end
198
241
 
199
242
  ##
@@ -205,8 +248,8 @@ module Mints
205
248
  #
206
249
  # ==== Example
207
250
  # @data = @mints_pub.get_form("form_slug")
208
- def get_form(slug)
209
- return @client.raw("get", "/content/forms/#{slug}", nil, nil, nil, nil, false)
251
+ def get_form(slug, options = nil)
252
+ return @client.raw("get", "/content/forms/#{slug}", options)
210
253
  end
211
254
 
212
255
  ##
@@ -214,7 +257,7 @@ module Mints
214
257
  # Submit a form with data.
215
258
  #
216
259
  # ==== Parameters
217
- # data:: (Hash) -- Data to be submited.
260
+ # data:: (Hash) -- Data to be submitted.
218
261
  #
219
262
  # ==== Example
220
263
  # data = {
@@ -286,8 +329,21 @@ module Mints
286
329
  #
287
330
  # ==== Example
288
331
  # @data = @mints_pub.get_content_page("test-page")
289
- def get_content_page(slug)
290
- return @client.raw("get", "/content/content-pages/#{slug}", nil, nil, nil, nil, false)
332
+ def get_content_page(slug, options = nil)
333
+ return @client.raw("get", "/content/content-pages/#{slug}", options)
334
+ end
335
+
336
+ ##
337
+ # === Get Content Bundle.
338
+ # Get a single content bundle.
339
+ #
340
+ # ==== Parameters
341
+ # slug:: (String) -- It's the string identifier generated by Mints.
342
+ #
343
+ # ==== Example
344
+ # @data = @mints_pub.get_content_page("test-page")
345
+ def get_content_bundle(slug, options = nil)
346
+ return @client.raw("get", "/content/content-pages/#{slug}", options)
291
347
  end
292
348
 
293
349
  ### V1/ECOMMERCE ###
@@ -353,7 +409,7 @@ module Mints
353
409
  # }
354
410
  # @data = @mints_pub.get_product("lego-set", options)
355
411
  def get_product(slug, options = nil)
356
- return @client.raw("get", "/ecommerce/products/#{slug}", options, nil, nil, nil, true)
412
+ return @client.raw("get", "/ecommerce/products/#{slug}", options)
357
413
  end
358
414
 
359
415
  ### V1/CONFIG ###
@@ -501,39 +557,21 @@ module Mints
501
557
  return @client.raw("get", "/config/attributes")
502
558
  end
503
559
 
504
- # Methods deleted
505
- ##
506
- # === Get categories.
507
- # Get a collection of categories.
508
- #
509
- # ==== Parameters
510
- # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
511
- #
512
- # ==== Example
513
- # options = {
514
- # "object_type": "stories"
515
- # }
516
- # @data = @mints_pub.get_categories(options)
517
- #def get_categories(options = nil)
518
- # return @client.raw("get", "/config/categories", options)
519
- #end
520
-
521
- ##
522
- # === Get Category.
523
- # Get a single category.
524
- #
525
- # ==== Parameters
526
- # slug:: (String) -- It's the string identifier generated by Mints.
527
- # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
528
- #
529
- # ==== Example
530
- # options = {
531
- # "object_type": "locations"
532
- # }
533
- # @data = @mints_pub.get_category("asset_slug", options)
534
- #def get_category(slug, options = nil)
535
- # return @client.raw("get", "/config/categories/#{slug}", options)
536
- #end
560
+ def send_user_magic_link(email_or_phone, template_slug, redirect_url = '', life_time = 1440, max_visits = nil, driver = 'email')
561
+ data = {
562
+ driver: driver,
563
+ lifeTime: life_time,
564
+ maxVisits: max_visits,
565
+ redirectUrl: redirect_url,
566
+ templateId: template_slug
567
+ }
568
+ if driver === 'sms' or driver === 'whatsapp'
569
+ data['phone'] = email_or_phone
570
+ else
571
+ data['email'] = email_or_phone
572
+ end
573
+ return @client.raw("post", "/users/magic-link", nil, { data: data }.to_json, '/api/v1')
574
+ end
537
575
 
538
576
  private
539
577
 
@@ -40,7 +40,7 @@ module ApiKeys
40
40
  # Create an api key with data.
41
41
  #
42
42
  # ==== Parameters
43
- # data:: (Hash) -- Data to be submited.
43
+ # data:: (Hash) -- Data to be submitted.
44
44
  #
45
45
  # ==== Example
46
46
  # data = {
@@ -44,7 +44,7 @@ module Appointments
44
44
  # Create an appointment with data.
45
45
  #
46
46
  # ==== Parameters
47
- # data:: (Hash) -- Data to be submited.
47
+ # data:: (Hash) -- Data to be submitted.
48
48
  #
49
49
  # ==== Example
50
50
  # data = {
@@ -65,7 +65,7 @@ module Appointments
65
65
  #
66
66
  # ==== Parameters
67
67
  # id:: (Integer) -- Appointment id.
68
- # data:: (Hash) -- Data to be submited.
68
+ # data:: (Hash) -- Data to be submitted.
69
69
  #
70
70
  # ==== Example
71
71
  # data = {
@@ -92,7 +92,7 @@ module Appointments
92
92
  # Schedule an appointment.
93
93
  #
94
94
  # ==== Parameters
95
- # data:: (Hash) -- Data to be submited.
95
+ # data:: (Hash) -- Data to be submitted.
96
96
  #
97
97
  # ==== Example
98
98
  # data = {
@@ -110,7 +110,7 @@ module Appointments
110
110
  # Reschedule an appointment.
111
111
  #
112
112
  # ==== Parameters
113
- # data:: (Hash) -- Data to be submited.
113
+ # data:: (Hash) -- Data to be submitted.
114
114
  #
115
115
  # ==== Example
116
116
  # data = {
@@ -127,7 +127,7 @@ module Appointments
127
127
  # Attach invitee.
128
128
  #
129
129
  # ==== Parameters
130
- # data:: (Hash) -- Data to be submited.
130
+ # data:: (Hash) -- Data to be submitted.
131
131
  #
132
132
  # ==== Example
133
133
  # data = {
@@ -143,7 +143,7 @@ module Appointments
143
143
  # Attach follower.
144
144
  #
145
145
  # ==== Parameters
146
- # data:: (Hash) -- Data to be submited.
146
+ # data:: (Hash) -- Data to be submitted.
147
147
  #
148
148
  # ==== Example
149
149
  # data = {
@@ -159,7 +159,7 @@ module Appointments
159
159
  # Detach invitee.
160
160
  #
161
161
  # ==== Parameters
162
- # data:: (Hash) -- Data to be submited.
162
+ # data:: (Hash) -- Data to be submitted.
163
163
  #
164
164
  # ==== Example
165
165
  # data = {
@@ -175,7 +175,7 @@ module Appointments
175
175
  # Detach follower.
176
176
  #
177
177
  # ==== Parameters
178
- # data:: (Hash) -- Data to be submited.
178
+ # data:: (Hash) -- Data to be submitted.
179
179
  #
180
180
  # ==== Example
181
181
  # data = {
@@ -191,7 +191,7 @@ module Appointments
191
191
  # Sync invitee.
192
192
  #
193
193
  # ==== Parameters
194
- # data:: (Hash) -- Data to be submited.
194
+ # data:: (Hash) -- Data to be submitted.
195
195
  #
196
196
  # ==== Example
197
197
  # data = {
@@ -207,7 +207,7 @@ module Appointments
207
207
  # Sync follower.
208
208
  #
209
209
  # ==== Parameters
210
- # data:: (Hash) -- Data to be submited.
210
+ # data:: (Hash) -- Data to be submitted.
211
211
  #
212
212
  # ==== Example
213
213
  # data = {
@@ -44,7 +44,7 @@ module AttributeGroups
44
44
  # Create an attribute group with data.
45
45
  #
46
46
  # ==== Parameters
47
- # data:: (Hash) -- Data to be submited.
47
+ # data:: (Hash) -- Data to be submitted.
48
48
  #
49
49
  # ==== Example
50
50
  # data = {
@@ -61,7 +61,7 @@ module AttributeGroups
61
61
  #
62
62
  # ==== Parameters
63
63
  # id:: (Integer) -- Attribute group id.
64
- # data:: (Hash) -- Data to be submited.
64
+ # data:: (Hash) -- Data to be submitted.
65
65
  #
66
66
  # ==== Example
67
67
  # data = {