mints 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/client.rb +38 -32
  3. data/lib/contact.rb +65 -60
  4. data/lib/mints/controllers/base_api_controller.rb +4 -4
  5. data/lib/mints/controllers/base_controller.rb +12 -3
  6. data/lib/mints_helper.rb +47 -0
  7. data/lib/pub.rb +75 -87
  8. data/lib/user/config/api_keys.rb +65 -0
  9. data/lib/user/config/appointments.rb +221 -0
  10. data/lib/user/config/attribute_groups.rb +77 -0
  11. data/lib/user/config/attributes.rb +86 -0
  12. data/lib/user/config/calendars.rb +89 -0
  13. data/lib/user/config/config.rb +65 -0
  14. data/lib/user/config/importers.rb +184 -0
  15. data/lib/user/config/public_folders.rb +108 -0
  16. data/lib/user/config/relationships.rb +138 -0
  17. data/lib/user/config/roles.rb +84 -0
  18. data/lib/user/config/seeds.rb +14 -0
  19. data/lib/user/config/system_settings.rb +53 -0
  20. data/lib/user/config/tags.rb +63 -0
  21. data/lib/user/config/taxonomies.rb +124 -0
  22. data/lib/user/config/teams.rb +70 -0
  23. data/lib/user/config/users.rb +76 -0
  24. data/lib/user/contacts/contacts.rb +21 -0
  25. data/lib/user/content/assets.rb +98 -0
  26. data/lib/user/content/content.rb +235 -0
  27. data/lib/user/content/content_instances.rb +147 -0
  28. data/lib/user/content/content_templates.rb +111 -0
  29. data/lib/user/content/conversations.rb +174 -0
  30. data/lib/user/content/dam.rb +88 -0
  31. data/lib/user/content/forms.rb +168 -0
  32. data/lib/user/content/message_templates.rb +162 -0
  33. data/lib/user/content/messages.rb +90 -0
  34. data/lib/user/content/pages.rb +81 -0
  35. data/lib/user/content/stories.rb +164 -0
  36. data/lib/user/content/story_templates.rb +95 -0
  37. data/lib/user/crm/companies.rb +111 -0
  38. data/lib/user/crm/contacts.rb +312 -0
  39. data/lib/user/crm/crm.rb +21 -0
  40. data/lib/user/crm/deals.rb +111 -0
  41. data/lib/user/crm/favorites.rb +17 -0
  42. data/lib/user/crm/segments.rb +132 -0
  43. data/lib/user/crm/users.rb +22 -0
  44. data/lib/user/crm/workflow_step_objects.rb +89 -0
  45. data/lib/user/crm/workflow_steps.rb +49 -0
  46. data/lib/user/crm/workflows.rb +70 -0
  47. data/lib/user/ecommerce/ecommerce.rb +29 -0
  48. data/lib/user/ecommerce/item_prices.rb +86 -0
  49. data/lib/user/ecommerce/locations.rb +166 -0
  50. data/lib/user/ecommerce/order_items_groups.rb +109 -0
  51. data/lib/user/ecommerce/order_statuses.rb +26 -0
  52. data/lib/user/ecommerce/orders.rb +258 -0
  53. data/lib/user/ecommerce/price_lists.rb +73 -0
  54. data/lib/user/ecommerce/product_templates.rb +104 -0
  55. data/lib/user/ecommerce/product_variations.rb +129 -0
  56. data/lib/user/ecommerce/products.rb +169 -0
  57. data/lib/user/ecommerce/skus.rb +88 -0
  58. data/lib/user/ecommerce/taxes.rb +82 -0
  59. data/lib/user/ecommerce/variant_options.rb +69 -0
  60. data/lib/user/ecommerce/variant_values.rb +72 -0
  61. data/lib/user/helpers/helpers.rb +113 -0
  62. data/lib/user/helpers/object_activities.rb +83 -0
  63. data/lib/user/helpers/object_folders.rb +82 -0
  64. data/lib/user/helpers/user_folders.rb +83 -0
  65. data/lib/user/marketing/marketing.rb +120 -0
  66. data/lib/user/profile/profile.rb +111 -0
  67. data/lib/user.rb +22 -922
  68. metadata +61 -1
data/lib/user.rb CHANGED
@@ -1,4 +1,14 @@
1
1
  require_relative './client.rb'
2
+ require_relative './mints_helper.rb'
3
+ require_relative './user/crm/crm.rb'
4
+ require_relative './user/content/content.rb'
5
+ require_relative './user/marketing/marketing.rb'
6
+ require_relative './user/ecommerce/ecommerce.rb'
7
+ require_relative './user/config/config.rb'
8
+ require_relative './user/profile/profile.rb'
9
+ require_relative './user/helpers/helpers.rb'
10
+ require_relative './user/contacts/contacts.rb'
11
+
2
12
  module Mints
3
13
  ##
4
14
  # == User context API
@@ -27,10 +37,18 @@ module Mints
27
37
  # * +taxonomies+ - [Boolean] attach categories to response
28
38
  # * +tags+ - [Boolean] attach tags to response
29
39
  class User
40
+ include CRM
41
+ include Content
42
+ include Marketing
43
+ include Ecommerce
44
+ include Config
45
+ include Profile
46
+ include Helpers
47
+ include Contacts
48
+
30
49
  attr_reader :client
31
50
  def initialize(host, api_key, session_token = nil, debug = false)
32
51
  @client = Mints::Client.new(host, api_key, 'user', session_token, nil, debug)
33
- @content_route = '/api/user/v1/content'
34
52
  end
35
53
 
36
54
  def login(email, password)
@@ -38,7 +56,7 @@ module Mints
38
56
  email: email,
39
57
  password: password,
40
58
  }
41
- response = @client.raw("post", "/users/login", nil, data, '/api/v1')
59
+ response = @client.raw("post", "/users/login", nil, data.to_json, '/api/v1', {'no_content_type': true})
42
60
  if response.key? "api_token"
43
61
  @client.session_token = response["api_token"]
44
62
  end
@@ -62,927 +80,9 @@ module Mints
62
80
  return response
63
81
  end
64
82
 
65
- ##
66
- # === Me.
67
- # Get contact logged info
68
- #
69
- def me
70
- return @client.get__profile__me
71
- end
72
- ######################################### CRM #########################################
73
-
74
- #TODO: Add options to every method and test
75
-
76
- ##
77
- # == Contacts
78
- #
79
-
80
- def get_support_datas #TODO: rename
81
- return @client.raw("get", "/crm/contacts/support-data")
82
- end
83
-
84
- def get_online_activity(id)
85
- return @client.raw("get", "/crm/contacts/#{id}/online-activity")
86
- end
87
-
88
- ##
89
- # === Get contacts.
90
- # Get a collection of contacts
91
- #
92
- # ==== Parameters
93
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
94
- def get_contacts(options = nil)
95
- return @client.raw("get", "/crm/contacts", options)
96
- end
97
-
98
- def get_contact(id, options = nil)
99
- return @client.raw("get", "/crm/contacts/#{id}", options)
100
- end
101
-
102
- def create_contact(data, options = nil)
103
- return @client.raw("post", "/crm/contacts", options, data)
104
- end
105
-
106
- def update_contact(id, data, options = nil)
107
- return @client.raw("put", "/crm/contacts/#{id}", options, data)
108
- end
109
-
110
- def get_contact_deals(contact_id)
111
- return @client.raw("get", "/crm/contacts/#{contact_id}/deals")
112
- end
113
-
114
- def create_contact_deals(contact_id, data)
115
- return @client.raw("post", "/crm/contacts/#{contact_id}/deals", nil, data)
116
- end
117
-
118
- def delete_contact_deals(contact_id, data) #FIXME: MethodNotAllowedHttpException
119
- return @client.raw("delete", "/crm/contacts/#{contact_id}/deals", nil, data)
120
- end
121
-
122
- def get_contact_users(contact_id, options = nil)
123
- return @client.raw("get", "/crm/contacts/#{contact_id}/users", options)
124
- end
125
-
126
- def create_contact_users(contact_id, data)
127
- return @client.raw("post", "/crm/contacts/#{contact_id}/users", nil, data)
128
- end
129
-
130
- def delete_contact_users(contact_id, data) #FIXME: MethodNotAllowedHttpException
131
- return @client.raw("delete", "/crm/contacts/#{contact_id}/users", nil, data)
132
- end
133
-
134
- def get_contact_segments(contact_id)
135
- return @client.raw("get", "/crm/contacts/#{contact_id}/segments")
136
- end
137
-
138
- def get_contact_submissions(contact_id)
139
- return @client.raw("get", "/crm/contacts/#{contact_id}/submissions")
140
- end
141
-
142
- def get_contact_tags(contact_id)
143
- return @client.raw("get", "/crm/contacts/#{contact_id}/tags")
144
- end
145
-
146
- def get_contact_magic_links(contact_id)
147
- return @client.raw("get", "/crm/contacts/#{contact_id}/magic-links")
148
- end
149
-
150
- def create_contact_merge(id, data)
151
- return @client.raw("post", "/crm/contacts/#{id}/merge")
152
- end
153
-
154
- def send_magic_links(data)
155
- return @client.raw("post", "/crm/contacts/send-magic-link", nil, data)
156
- end
157
-
158
- ##
159
- # == Contacts Bulk Actions
160
- #
161
-
162
- def delete_contacts(data)
163
- return @client.raw("delete", "/crm/contacts/delete", nil, data)
164
- end
165
-
166
- ##
167
- # == Deals
168
- #
169
-
170
- def get_deal_permits(id)
171
- return @client.raw("get", "/crm/deals/#{id}/permits")
172
- end
173
-
174
- def get_deal_support_data
175
- return @client.raw("get", "/crm/deals/support-data")
176
- end
177
-
178
- def get_deal_currencies
179
- return @client.raw("get", "/crm/deal/currencies")
180
- end
181
-
182
- # === Get deals.
183
- # Get a collection of deals
184
- #
185
- # ==== Parameters
186
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
187
- def get_deals(options = nil)
188
- return @client.raw("get", "/crm/deals", options)
189
- end
190
-
191
- def get_deal(id, options = nil)
192
- return @client.raw("get", "/crm/deals/#{id}", options)
193
- end
194
-
195
- def create_deal(data)
196
- return @client.raw("post", "/crm/deals", nil, data)
197
- end
198
-
199
- def update_deal(id, data)
200
- return @client.raw("put", "/crm/deals/#{id}", nil, data)
201
- end
202
-
203
- ##
204
- # == Companies
205
- #
206
-
207
- def get_companies_support_data
208
- return @client.raw("get", "/crm/companies/support-data")
209
- end
210
-
211
- # === Get companies.
212
- # Get a collection of companies
213
- #
214
- # ==== Parameters
215
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
216
- def get_companies(options = nil)
217
- return @client.raw("get", "/crm/companies", options)
218
- end
219
-
220
- def get_company(id, options = nil)
221
- return @client.raw("get", "/crm/companies/#{id}", options)
222
- end
223
-
224
- def create_company(data)
225
- return @client.raw("post", "/crm/companies/", nil, data)
226
- end
227
-
228
- def update_company(id, data)
229
- return @client.raw("put", "/crm/companies/#{id}", nil, data)
230
- end
231
-
232
- ##
233
- # == Companies Bulk Actions
234
- #
235
-
236
- def delete_companies(data)
237
- return @client.raw("delete", "/crm/companies/delete", nil, data)
238
- end
239
-
240
- ##
241
- # == Workflows
242
- #
243
-
244
- def get_workflows(options = nil)
245
- return @client.raw("get", "/crm/workflows", options)
246
- end
247
-
248
- def get_workflow(id, options = nil)
249
- return @client.raw("get", "/crm/workflows/#{id}", options)
250
- end
251
-
252
- def create_workflow(data)
253
- return @client.raw("post", "/crm/workflows/", nil, data)
254
- end
255
-
256
- def update_workflow(id, data)
257
- return @client.raw("put", "/crm/workflows/#{id}", nil, data)
258
- end
259
-
260
- ##
261
- # == Workflow Step Objects
262
- #
263
-
264
- def get_step_objects(options = nil)
265
- return @client.raw("get", "/crm/step-objects", options)
266
- end
267
-
268
- def get_step_object(id, options = nil)
269
- return @client.raw("get", "/crm/step-objects/#{id}", options)
270
- end
271
-
272
- def create_step_object(data)
273
- return @client.raw("post", "/crm/step-objects/", nil, data)
274
- end
275
-
276
- def update_step_object(id, data)
277
- return @client.raw("put", "/crm/step-objects/#{id}", nil, data)
278
- end
279
-
280
- def get_step_object_by_object_type(objectType, objectId, options = nil)
281
- return @client.raw("get", "/crm/step-objects/#{objectType}/#{objectId}", options)
282
- end
283
-
284
- ##
285
- # == Workflow Steps
286
- #
287
-
288
- def create_workflow_step(data)
289
- return @client.raw("post", "/crm/steps", nil, data)
290
- end
291
-
292
- def update_workflow_step(id, data)
293
- return @client.raw("put", "/crm/steps/#{id}", nil, data)
294
- end
295
-
296
- def delete_workflow_step(id) #FIXME: DELETE DOESN'T WORK
297
- return @client.raw("delete", "/crm/steps/#{id}")
298
- end
299
-
300
- ##
301
- # == Favorites #TODO: NOT CHECKED, NO DATA IN DB
302
- #
303
-
304
- def update_multiple_favorites(data)
305
- return @client.raw("put", "/crm/favorites", nil, data)
306
- end
307
-
308
- def get_favorites(options = nil)
309
- return @client.raw("get", "/crm/favorites", options)
310
- end
311
-
312
- def update_favorites(id, data)
313
- return @client.raw("put", "/crm/favorites/#{id}", nil, data)
314
- end
315
-
316
- ##
317
- # == Segments
318
- #
319
-
320
- def get_segment_support_datas
321
- return @client.raw("get", "/crm/segments/support-data")
322
- end
323
-
324
- def get_segment_attributes(options = nil)
325
- return @client.raw("get", "/crm/segments/attributes", options)
326
- end
327
-
328
- def get_segment_group(groupId)
329
- return @client.raw("get", "/crm/segments/groups/#{groupId}")
330
- end
331
-
332
- def duplicate_segment(id, data)
333
- return @client.raw("post", "/crm/segments/#{id}/duplicate", nil, data)
334
- end
335
-
336
- def get_segments(options = nil)
337
- return @client.raw("get", "/crm/segments", options)
338
- end
339
-
340
- def get_segment(id, options = nil)
341
- return @client.raw("get", "/crm/segments/#{id}", options)
342
- end
343
-
344
- def create_segment(data)
345
- return @client.raw("post", "/crm/segments", nil, data)
346
- end
347
-
348
- def update_segment(id, data)
349
- return @client.raw("put", "/crm/segments/#{id}", nil, data)
350
- end
351
-
352
- def delete_segment(id)
353
- return @client.raw("delete", "/crm/segments/#{id}")
354
- end
355
-
356
- ##
357
- # == Users
358
- #
359
-
360
- def get_users(options = nil)
361
- return @client.raw("get", "/crm/users", options, nil)
362
- end
363
-
364
-
365
- ######################################### Content #########################################
366
-
367
-
368
- ##
369
- # == Pages
370
- #
371
-
372
- def get_pages_groups
373
- return @client.raw("get", "/content/pages/groups")
374
- end
375
-
376
- def get_pages
377
- return @client.raw("get", "/content/pages")
378
- end
379
-
380
- def get_page(id)
381
- return @client.raw("get", "/content/pages/#{id}")
382
- end
383
-
384
- def create_page(data)
385
- return @client.raw("post", "/content/pages", nil, data)
386
- end
387
-
388
- def update_page(id, data)
389
- return @client.raw("put", "/content/pages/#{id}", nil, data)
390
- end
391
-
392
- def delete_page(id)
393
- return @client.raw("delete", "/content/pages/#{id}")
394
- end
395
-
396
- ##
397
- # == Forms
398
- #
399
-
400
- def get_forms(options = nil)
401
- return @client.raw("get", "/content/forms", options)
402
- end
403
-
404
- def get_form(id, options = nil)
405
- return @client.raw("get", "/content/forms/#{id}", options)
406
- end
407
-
408
- def duplicate_form(id)
409
- return @client.raw("post", "/content/forms/#{id}/duplicate")
410
- end
411
-
412
- def get_form_support_data()
413
- return @client.raw("get", "/content/forms/support-data")
414
- end
415
-
416
- def get_form_submissions(options = nil)
417
- return @client.raw("get", "/content/forms/submissions", options)
418
- end
419
-
420
- def create_form(data)
421
- return @client.raw("post", "/content/forms", nil, data)
422
- end
423
-
424
- def update_form(id, data)
425
- return @client.raw("put", "/content/forms/#{id}", nil, data)
426
- end
427
-
428
- def delete_form(id)
429
- return @client.raw("delete", "/content/forms/#{id}")
430
- end
431
-
432
- ##
433
- # == Content templates
434
- #
435
-
436
- def get_content_template_instances(templateId)
437
- return @client.raw("get", "/content/templates/#{templateId}/instances")
438
- end
439
-
440
- def duplicate_content_template(id)
441
- return @client.raw("post", "/content/templates/#{id}/duplicate/")
442
- end
443
-
444
- # === Get content templates.
445
- # Get a collection of content templates
446
- #
447
- # ==== Parameters
448
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
449
- def get_content_templates(options = nil)
450
- return @client.raw("get", "/content/templates", options)
451
- end
452
-
453
- def get_content_template(id)
454
- return @client.raw("get", "/content/templates/#{id}")
455
- end
456
-
457
- def create_content_template(data)
458
- #FIXME: Method doesn't work, controller cannot get template info from request variable.
459
- return @client.raw("post", "/content/templates", nil, data)
460
- end
461
-
462
- def update_content_template(id, data)
463
- #FIXME: Method doesn't work, controller cannot get template info from request variable.
464
- return @client.raw("put", "/content/templates/#{id}", nil, data)
465
- end
466
-
467
- def delete_content_template(id)
468
- #TODO: NOT TESTED
469
- return @client.raw("delete", "/content/templates/#{id}")
470
- end
471
-
472
- ##
473
- # == Content Instances
474
- #
475
-
476
- # === Get content instances.
477
- # Get a collection of content instances
478
- #
479
- # ==== Parameters
480
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
481
- def get_content_instances(options = nil)
482
- return @client.raw("get", "/content/instances", options)
483
- end
484
-
485
- def duplicate_content_instance(id, data)
486
- return @client.raw("post", "/content/instances/#{id}/duplicate", nil, data)
487
- end
488
-
489
- def get_content_instance(id, options = nil)
490
- return @client.raw("get", "/content/instances/#{id}", options)
491
- end
492
-
493
- def publish_content_instance(id, data)
494
- return @client.raw("put", "/content/instances/#{id}/publish", nil, data)
495
- end
496
-
497
- def schedule_content_instance(id, data) #FIXME: Undefined index: scheduled_at
498
- return @client.raw("put", "/content/instances/#{id}/schedule", nil, data)
499
- end
500
-
501
- def revert_published_data_from_content_instance(id)
502
- return @client.raw("get", "/content/instances/#{id}/revert-published-data")
503
- end
504
-
505
- def create_content_instance(data)
506
- return @client.raw("post", "/content/instances", nil, data)
507
- end
508
-
509
- def update_content_instance(id, data)
510
- return @client.raw("put", "/content/instances/#{id}", nil, data)
511
- end
512
-
513
- def delete_content_instance(id)
514
- return @client.raw("delete", "/content/instances/#{id}")
515
- end
516
-
517
- ##
518
- # == OTHER
519
- #
520
-
521
- def get_authors
522
- return @client.raw("get", "/content/authors")
523
- end
524
-
525
- def get_keywords(options = nil)
526
- return @client.raw("get", "/content/keywords", options)
527
- end
528
-
529
- def get_public_images_url
530
- return @client.raw("get", "/content/public-images-url")
531
- end
532
-
533
- def get_stages(options = nil)
534
- return @client.raw("get", "/content/stages", options)
535
- end
536
-
537
- ##
538
- # == dam
539
- #
540
-
541
- def get_dam_loadtree
542
- return @client.raw("get", "/content/dam/loadtree")
543
- end
544
-
545
- def get_dam_asset_locations(options)
546
- return @client.raw("get", "/content/dam/asset-locations", options)
547
- end
548
-
549
- def paste_dam(data) #FIXME: Invalid argument supplied for foreach()
550
- return @client.raw("post", "/content/dam/paste", nil, data)
551
- end
552
-
553
- def rename_dam(data) #TODO: No validate
554
- return @client.raw("post", "/content/dam/rename", nil, data)
555
- end
556
-
557
- def search_dam(data)
558
- return @client.raw("post", "/content/dam/search", nil, data)
559
- end
560
-
561
- def send_to_trash_dam(data) #FIXME: Invalid argument supplied for foreach()
562
- return @client.raw("post", "/content/dam/sendToTrash", nil, data)
563
- end
564
-
565
- def delete_dam(data) #FIXME: Invalid argument supplied for foreach()
566
- return @client.raw("post", "/content/dam/delete", nil, data)
567
- end
568
-
569
- def create_dam_folder(data)
570
- return @client.raw("post", "/content/folders/create", nil, data)
571
- end
572
-
573
- ##
574
- # == Assets
575
- #
576
-
577
- def create_asset(data) #TODO: ask for renaming to 'upload asset'
578
- return @client.raw("post", "/content/assets/upload", nil, data)
579
- end
580
-
581
- def get_asset_link_info(data)
582
- return @client.raw("post", "/content/assets/getLinkInfo", nil, data)
583
- end
584
-
585
- def download_asset(id) #FIXME: File not found at path
586
- return @client.raw("get", "/content/assets/download/#{id}")
587
- end
588
-
589
- def edit_asset_size(data) #TODO: Not tested
590
- return @client.raw("post", "/content/assets/editSize", nil, data)
591
- end
592
-
593
- def upload_asset_variation(data) #FIXME: Call to a member function guessClientExtension() on null
594
- return @client.raw("post", "/content/assets/uploadVariation", nil, data)
595
- end
596
-
597
- def create_asset_size(data) #FIXME: Trying to get property 'path' of non-object
598
- return @client.raw("post", "/content/assets/createSize", nil, data)
599
- end
600
-
601
- def update_asset_variation(id, data) #TODO:
602
- return @client.raw("post", "/content/assets/updateVariation/#{id}", nil, data)
603
- end
604
-
605
- def get_asset_sizes(id) #FIXME: wrong number of arguments (given 1, expected 0)
606
- return @client.raw("get", "/content/assets/sizes/#{id}")
607
- end
608
-
609
- def get_original_asset(id) #FIXME: Doesn't return JSON
610
- return @client.raw("get", "/content/assets/original/#{id}")
611
- end
612
-
613
- def get_asset_variation(id)
614
- #FIXME: Id 1 and 4: Trying to get property 'path' of non-object
615
- #FIXME: Id 2 and 3: File not found at path maybe doesnt exist
616
- return @client.raw("get", "/content/assets/variation/#{id}")
617
- end
618
-
619
- def get_asset_sizes(options)
620
- return @client.raw("get", "/content/assets/getSizes", options)
621
- end
622
-
623
- def get_asset_usage(options)
624
- return @client.raw("get", "/content/assets/usage", options)
625
- end
626
-
627
- def delete_asset_variation #TODO: Not tested
628
- return @client.raw("get", "/content/assets/deleteVariation")
629
- end
630
-
631
- def delete_asset_size #TODO: Not tested
632
- return @client.raw("get", "/content/assets/deleteSize")
633
- end
634
-
635
- def get_asset_info(options)
636
- return @client.raw("get", "/content/assets/getAssetInfo", options)
637
- end
638
-
639
- def generate_asset_variation(data) #FIXME: Trying to get property 'width' of non-object
640
- return @client.raw("post", "/content/assets/generateAssetVariations", nil, data)
641
- end
642
-
643
- def get_asset_doc_types
644
- return @client.raw("get", "/content/assets/docTypes")
645
- end
646
-
647
- def get_asset_public_route
648
- return @client.raw("get", "/content/assets/publicRoute")
649
- end
650
-
651
- ##
652
- # == Story Template
653
- #
654
-
655
- def get_support_data_of_story_template(id)
656
- return @client.raw("get", "/content/story-templates/support-data/stories/#{id}")
657
- end
658
-
659
- def get_support_data_of_story_templates
660
- return @client.raw("get", "/content/story-templates/support-data")
661
- end
662
-
663
- def get_story_templates(options = nil)
664
- return @client.raw("get", "/content/story-templates", options)
665
- end
666
-
667
- def get_story_template(id, options = nil)
668
- return @client.raw("get", "/content/story-templates/#{id}", options)
669
- end
670
-
671
- def create_story_template(data)
672
- return @client.raw("post", "/content/story-templates", nil, data)
673
- end
674
-
675
- def update_story_template(id, data) #FIXME: InternalServerError
676
- return @client.raw("put", "/content/story-templates/#{id}", nil, data)
677
- end
678
-
679
- ##
680
- # == Story
681
- #
682
-
683
- def publish_story(id, data) #FIXME: Invalid argument supplied for foreach()
684
- return @client.raw("put", "/content/stories/#{id}/publish", nil, data)
685
- end
686
-
687
- def schedule_story(id, data) #FIXME: Invalid argument supplied for foreach()
688
- return @client.raw("put", "/content/stories/#{id}/schedule", nil, data)
689
- end
690
-
691
- def revert_published_story(id)
692
- return @client.raw("get", "/content/stories/#{id}/revert-published-data")
693
- end
694
-
695
- def get_story_support_data
696
- return @client.raw("get", "/content/stories/support-data")
697
- end
698
-
699
- def duplicate_story(id, data)
700
- return @client.raw("post", "/content/stories/#{id}/duplicate", nil, data)
701
- end
702
-
703
- def get_stories(options = nil)
704
- return @client.raw("get", "/content/stories", options)
705
- end
706
-
707
- def get_story(id, options = nil)
708
- return @client.raw("get", "/content/stories/#{id}", options)
709
- end
710
-
711
- def create_story(data)
712
- return @client.raw("post", "/content/stories", nil, data)
713
- end
714
-
715
- def update_story(id, data) #FIXME: InternalServerError
716
- return @client.raw("put", "/content/stories/#{id}", nil, data)
717
- end
718
-
719
- def delete_story(id)
720
- return @client.raw("delete", "/content/stories/#{id}")
721
- end
722
-
723
- ##
724
- # == Email Template
725
- #
726
-
727
- def get_content_pages_from_email_template(id) #FIXME: ContentController doesnt have getContentPage method
728
- return @client.raw("get", "/content/email-templates/content-pages/#{id}")
729
- end
730
-
731
- def get_variables_of_content_pages_from_email_template(id)
732
- return @client.raw("get", "/content/email-templates/content-pages/#{id}/variables")
733
- end
734
-
735
- def get_recipient_variables
736
- return @client.raw("get", "/content/email-templates/recipient-variables")
737
- end
738
-
739
- def get_driver_templates
740
- return @client.raw("get", "/content/email-templates/driver/templates")
741
- end
742
-
743
- def preview_email_template(data)
744
- return @client.raw("post", "/content/email-templates/preview", nil, data)
745
- end
746
-
747
- def send_email_template(data)
748
- return @client.raw("post", "/content/email-templates/send", nil, data)
749
- end
750
-
751
- def duplicate_email_template(id, data)
752
- return @client.raw("post", "/content/email-templates/#{id}/duplicate", nil, data)
753
- end
754
-
755
- def get_email_templates(options = nil)
756
- return @client.raw("get", "/content/email-templates", options)
757
- end
758
-
759
- def get_email_template(id, options = nil)
760
- return @client.raw("get", "/content/email-templates/#{id}", options)
761
- end
762
-
763
- def create_email_template(data)
764
- return @client.raw("post", "/content/email-templates", nil, data)
765
- end
766
-
767
- def update_email_template(id, data)
768
- return @client.raw("put", "/content/email-templates/#{id}", nil, data)
769
- end
770
-
771
- def delete_email_template(id)
772
- return @client.raw("delete", "/content/email-templates/#{id}")
773
- end
774
-
775
- ##
776
- # == Keywords
777
- #
778
-
779
- def get_keyword(id)
780
- return @client.raw("get", "/content/keywords/#{id}")
781
- end
782
-
783
- def create_keyword(data)
784
- return @client.raw("post", "/content/keywords", nil, data)
785
- end
786
-
787
- def update_keyword(id, data) #FIXME: Method doesn't work, controller cannot get keyword info from request variable.
788
- return @client.raw("put", "/content/keywords/#{id}", nil, data)
789
- end
790
-
791
- ##
792
- # == Authors
793
- #
794
-
795
- def get_author(id)
796
- return @client.raw("get", "/content/authors/#{id}")
797
- end
798
-
799
- def create_author(data)
800
- return @client.raw("post", "/content/authors", nil, data)
801
- end
802
-
803
- def update_author(id, data) #FIXME: Method doesn't work, controller cannot get author data from request variable.
804
- return @client.raw("put", "/content/authors/#{id}", nil, data)
805
- end
806
-
807
- ##
808
- # == Stages
809
- #
810
-
811
- def get_stage(id)
812
- return @client.raw("get", "/content/stages/#{id}")
813
- end
814
-
815
- def create_stage(data) #FIXME: Cannot insert data into database successfully
816
- return @client.raw("post", "/content/stages", nil, data)
817
- end
818
-
819
- def update_stage(id, data) #FIXME: Method doesn't work, controller cannot get stage data from request variable.
820
- return @client.raw("put", "/content/stages/#{id}", nil, data)
821
- end
822
-
823
-
824
- ######################################### Marketing #########################################
825
-
826
-
827
- ##
828
- # == Automation
829
- #
830
-
831
- def get_automations(options = nil)
832
- return @client.raw("get", "/marketing/automation", options)
833
- end
834
-
835
- def get_automation(id, options = nil)
836
- return @client.raw("get", "/marketing/automation/#{id}", options)
837
- end
838
-
839
- def create_automation(data)
840
- return @client.raw("post", "/marketing/automation/", nil, data)
841
- end
842
-
843
- def update_automation(id, data) #FIXME: Method doesn't work, controller cannot get automation data from request variable.
844
- return @client.raw("put", "/marketing/automation/#{id}", nil, data)
845
- end
846
-
847
- def delete_automation(id)
848
- return @client.raw("delete", "/marketing/automation/#{id}")
849
- end
850
-
851
- def get_automation_executions(id)
852
- return @client.raw("get", "/marketing/automation/#{id}/executions")
853
- end
854
-
855
- def reset_automation(id)
856
- return @client.raw("post", "/marketing/automation/#{id}/reset")
857
- end
858
-
859
- def duplicate_automation(id, data)
860
- return @client.raw("post", "/marketing/automation/#{id}/duplicate", nil, data)
861
- end
862
-
863
-
864
- ######################################### Ecommerce #########################################
865
-
866
-
867
- ##
868
- # == Price List
869
- #
870
-
871
- def get_price_lists(options = nil)
872
- return @client.raw("get", "/ecommerce/price-list", options)
873
- end
874
-
875
- def get_price_list(id, options = nil)
876
- return @client.raw("get", "/ecommerce/price-list/#{id}", options)
877
- end
878
-
879
- def create_price_list(data)
880
- return @client.raw("post", "/ecommerce/price-list", nil, data)
881
- end
882
-
883
- def update_price_list(id, data)
884
- return @client.raw("put", "/ecommerce/price-list/#{id}", nil, data)
885
- end
886
-
887
- ##
888
- # == Product
889
- #
890
-
891
- def update_product_variations_config(productId, data) #TODO: Research use
892
- return @client.raw("post", "/ecommerce/products/update-variations-config/#{productId}", nil, data)
893
- end
894
-
895
- def get_product_support_data
896
- return @client.raw("get", "/ecommerce/products/support-data")
897
- end
898
-
899
- def delete_product(id)
900
- return @client.raw("delete", "/ecommerce/products/#{id}")
901
- end
902
-
903
- def publish_product(id, data) #TODO: Research data in publish
904
- return @client.raw("put", "/ecommerce/products/#{id}/publish", nil, data)
905
- end
906
-
907
- def schedule_product(id, data)
908
- return @client.raw("put", "/ecommerce/products/#{id}/schedule", nil, data)
909
- end
910
-
911
- def get_product_variant_options_config(id)
912
- return @client.raw("get", "/ecommerce/products/#{id}/variant-options-config")
913
- end
914
-
915
- def revert_published_data(id)
916
- return @client.raw("get", "/ecommerce/products/#{id}/revert-published-data")
917
- end
918
-
919
- def get_products(options = nil)
920
- return @client.raw("get", "/ecommerce/products", options)
921
- end
922
-
923
- def get_product(id, options = nil)
924
- return @client.raw("get", "/ecommerce/products/#{id}", options)
925
- end
926
-
927
- def create_product(data)
928
- return @client.raw("post", "/ecommerce/products/", nil, data)
929
- end
930
-
931
- def update_product(id, data)
932
- return @client.raw("put", "/ecommerce/products/#{id}", nil, data)
933
- end
934
-
935
- ##
936
- # == Locations
937
- #
938
-
939
- def get_locations
940
- return @client.raw("get", "/ecommerce/locations")
941
- end
942
-
943
- def get_location(id)
944
- return @client.raw("get", "/ecommerce/locations/#{id}")
945
- end
946
-
947
- def create_location(data)
948
- return @client.raw("post", "/ecommerce/locations", nil, data)
949
- end
950
-
951
- def update_location(id, data)
952
- return @client.raw("put", "/ecommerce/locations/#{id}", nil, data)
953
- end
954
-
955
- def delete_location(id)
956
- return @client.raw("delete", "/ecommerce/locations/#{id}")
957
- end
958
-
959
- ##
960
- # == Locations Templates
961
- #
962
-
963
- def get_location_template_support_data(id)
964
- return @client.raw("get", "/ecommerce/location-templates/#{id}/support-data")
965
- end
966
-
967
- def get_location_templates_support_data
968
- return @client.raw("get", "/ecommerce/location-templates/support-data")
969
- end
970
-
971
- def get_location_templates(options = nil)
972
- return @client.raw("get", "/ecommerce/location-templates", options)
973
- end
974
-
975
- def get_location_template(id, options = nil)
976
- return @client.raw("get", "/ecommerce/location-templates/#{id}", options)
977
- end
83
+ private
978
84
 
979
- def create_location_template(data)
980
- return @client.raw("post", "/ecommerce/location-templates", nil, data)
981
- end
982
-
983
- def update_location_template(id, data)
984
- return @client.raw("put", "/ecommerce/location-templates/#{id}", nil, data)
985
- end
85
+ include MintsHelper
986
86
 
987
87
  end
988
88
  end