mints 0.0.14 → 0.0.18

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.
data/lib/user.rb CHANGED
@@ -30,6 +30,7 @@ module Mints
30
30
  attr_reader :client
31
31
  def initialize(host, api_key, session_token = nil, debug = false)
32
32
  @client = Mints::Client.new(host, api_key, 'user', session_token, nil, debug)
33
+ @content_route = '/api/user/v1/content'
33
34
  end
34
35
 
35
36
  def login(email, password)
@@ -43,7 +44,47 @@ module Mints
43
44
  end
44
45
  return response
45
46
  end
47
+
48
+ def magic_link_login(token)
49
+ response = @client.raw("get", "/users/magic-link-login/#{token}", nil, nil, '/api/v1')
50
+ return response
51
+ end
52
+
53
+ ##
54
+ # === Send magic link to user
55
+ def send_magic_link(email, redirectUrl = '', lifeTime = 24)
56
+ data = {
57
+ email: email,
58
+ redirectUrl: redirectUrl,
59
+ lifeTime: lifeTime
60
+ }
61
+ response = @client.raw("post", "/users/magic-link", nil, { data: data }, '/api/v1')
62
+ return response
63
+ end
64
+
65
+ ##
66
+ # === Me.
67
+ # Get contact logged info
68
+ #
69
+ def me
70
+ return @client.get__profile__me
71
+ end
46
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
+
47
88
  ##
48
89
  # === Get contacts.
49
90
  # Get a collection of contacts
@@ -51,40 +92,91 @@ module Mints
51
92
  # ==== Parameters
52
93
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
53
94
  def get_contacts(options = nil)
54
- return @client.get__crm__contacts(options)
95
+ return @client.raw("get", "/crm/contacts", options)
55
96
  end
56
97
 
57
98
  def get_contact(id, options = nil)
58
- return @client.get__crm__contacts(id, options)
99
+ return @client.raw("get", "/crm/contacts/#{id}", options)
59
100
  end
60
101
 
61
102
  def create_contact(data, options = nil)
62
- return @client.create__crm__contacts(data, options)
103
+ return @client.raw("post", "/crm/contacts", options, data)
63
104
  end
64
105
 
65
106
  def update_contact(id, data, options = nil)
66
- return @client.update__crm__contacts(id, data, options)
107
+ return @client.raw("put", "/crm/contacts/#{id}", options, data)
67
108
  end
68
-
69
- # === Get companies.
70
- # Get a collection of companies
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
71
160
  #
72
- # ==== Parameters
73
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
74
- def get_companies(options = nil)
75
- return @client.get__crm__companies(options)
161
+
162
+ def delete_contacts(data)
163
+ return @client.raw("delete", "/crm/contacts/delete", nil, data)
76
164
  end
77
165
 
78
- def get_company(id, options = nil)
79
- return @client.get__crm__companies(id, options)
166
+ ##
167
+ # == Deals
168
+ #
169
+
170
+ def get_deal_permits(id)
171
+ return @client.raw("get", "/crm/deals/#{id}/permits")
80
172
  end
81
173
 
82
- def create_company(data, options = nil)
83
- return @client.create__crm__companies(data, options)
174
+ def get_deal_support_data
175
+ return @client.raw("get", "/crm/deals/support-data")
84
176
  end
85
177
 
86
- def update_company(id, data, options = nil)
87
- return @client.update__crm__companies(id, data, options)
178
+ def get_deal_currencies
179
+ return @client.raw("get", "/crm/deal/currencies")
88
180
  end
89
181
 
90
182
  # === Get deals.
@@ -93,104 +185,260 @@ module Mints
93
185
  # ==== Parameters
94
186
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
95
187
  def get_deals(options = nil)
96
- return @client.get__crm__deals(options)
188
+ return @client.raw("get", "/crm/deals", options)
97
189
  end
98
190
 
99
191
  def get_deal(id, options = nil)
100
- return @client.get__crm__deals(id, options)
192
+ return @client.raw("get", "/crm/deals/#{id}", options)
101
193
  end
102
194
 
103
- def create_deal(data, options = nil)
104
- return @client.create__crm__deals(data, options)
195
+ def create_deal(data)
196
+ return @client.raw("post", "/crm/deals", nil, data)
105
197
  end
106
198
 
107
- def update_deal(id, data, options = nil)
108
- return @client.update__crm__deals(id, data, options)
199
+ def update_deal(id, data)
200
+ return @client.raw("put", "/crm/deals/#{id}", nil, data)
109
201
  end
110
202
 
111
- ######################################### Content #########################################
112
- # === Get stories.
113
- # Get a collection of stories
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
114
213
  #
115
214
  # ==== Parameters
116
215
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
117
- def get_stories(options = nil)
118
- return @client.get__content__stories(options)
216
+ def get_companies(options = nil)
217
+ return @client.raw("get", "/crm/companies", options)
119
218
  end
120
219
 
121
- def get_story(id, options = nil)
122
- return @client.get__content__stories(id, options)
220
+ def get_company(id, options = nil)
221
+ return @client.raw("get", "/crm/companies/#{id}", options)
123
222
  end
124
223
 
125
- def create_story(data, options = nil)
126
- return @client.create__content__stories(data, options)
224
+ def create_company(data)
225
+ return @client.raw("post", "/crm/companies/", nil, data)
127
226
  end
128
227
 
129
- def update_story(id, data, options = nil)
130
- return @client.update__content__stories(id, data, options)
228
+ def update_company(id, data)
229
+ return @client.raw("put", "/crm/companies/#{id}", nil, data)
131
230
  end
132
231
 
133
- # === Get story templates.
134
- # Get a collection of story templates
232
+ ##
233
+ # == Companies Bulk Actions
135
234
  #
136
- # ==== Parameters
137
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
138
- def get_story_templates(options = nil)
139
- return @client.get__content__story_templates(options)
235
+
236
+ def delete_companies(data)
237
+ return @client.raw("delete", "/crm/companies/delete", nil, data)
140
238
  end
141
239
 
142
- def get_story_template(id, options = nil)
143
- return @client.get__content__story_templates(id, options)
240
+ ##
241
+ # == Workflows
242
+ #
243
+
244
+ def get_workflows(options = nil)
245
+ return @client.raw("get", "/crm/workflows", options)
144
246
  end
145
247
 
146
- def create_story_template(data, options = nil)
147
- return @client.create__content__story_templates(data, options)
248
+ def get_workflow(id, options = nil)
249
+ return @client.raw("get", "/crm/workflows/#{id}", options)
148
250
  end
149
251
 
150
- def update_story_template(id, data, options = nil)
151
- return @client.update__content__story_templates(id, data, options)
252
+ def create_workflow(data)
253
+ return @client.raw("post", "/crm/workflows/", nil, data)
152
254
  end
153
255
 
154
- # === Get content instances.
155
- # Get a collection of content instances
256
+ def update_workflow(id, data)
257
+ return @client.raw("put", "/crm/workflows/#{id}", nil, data)
258
+ end
259
+
260
+ ##
261
+ # == Workflow Step Objects
156
262
  #
157
- # ==== Parameters
158
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
159
- def get_content_instances(options = nil)
160
- return @client.get__content__instances(options)
263
+
264
+ def get_step_objects(options = nil)
265
+ return @client.raw("get", "/crm/step-objects", options)
161
266
  end
162
267
 
163
- def get_content_instance(id, options = nil)
164
- return @client.get__content__instances(id, options)
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)
165
274
  end
166
275
 
167
- def create_content_instance(data, options = nil)
168
- return @client.create__content__instances(data, options)
276
+ def update_step_object(id, data)
277
+ return @client.raw("put", "/crm/step-objects/#{id}", nil, data)
169
278
  end
170
279
 
171
- def update_content_instance(id, data, options = nil)
172
- return @client.update__content__instances(id, data, options)
280
+ def get_step_object_by_object_type(objectType, objectId, options = nil)
281
+ return @client.raw("get", "/crm/step-objects/#{objectType}/#{objectId}", options)
173
282
  end
174
283
 
175
- # === Get content pages.
176
- # Get a collection of content pages
284
+ ##
285
+ # == Workflow Steps
177
286
  #
178
- # ==== Parameters
179
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
180
- def get_content_pages(options = nil)
181
- return @client.get__content__pages(options)
287
+
288
+ def create_workflow_step(data)
289
+ return @client.raw("post", "/crm/steps", nil, data)
182
290
  end
183
291
 
184
- def get_content_page(id, options = nil)
185
- return @client.get__content__pages(id, options)
292
+ def update_workflow_step(id, data)
293
+ return @client.raw("put", "/crm/steps/#{id}", nil, data)
186
294
  end
187
295
 
188
- def create_content_page(data, options = nil)
189
- return @client.create__content__pages(data, options)
296
+ def delete_workflow_step(id) #FIXME: DELETE DOESN'T WORK
297
+ return @client.raw("delete", "/crm/steps/#{id}")
190
298
  end
191
299
 
192
- def update_content_page(id, data, options = nil)
193
- return @client.update__content__pages(id, data, options)
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/")
194
442
  end
195
443
 
196
444
  # === Get content templates.
@@ -199,209 +447,542 @@ module Mints
199
447
  # ==== Parameters
200
448
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
201
449
  def get_content_templates(options = nil)
202
- return @client.get__content__templates(options)
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}")
203
455
  end
204
456
 
205
- def get_content_template(id, options = nil)
206
- return @client.get__content__templates(id, options)
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)
207
460
  end
208
461
 
209
- def create_content_template(data, options = nil)
210
- return @client.create__content__templates(data, options)
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)
211
465
  end
212
466
 
213
- def update_content_template(id, data, options = nil)
214
- return @client.update__content__templates(id, data, options)
467
+ def delete_content_template(id)
468
+ #TODO: NOT TESTED
469
+ return @client.raw("delete", "/content/templates/#{id}")
215
470
  end
216
471
 
217
- # === Get products.
218
- # Get a collection of products
472
+ ##
473
+ # == Content Instances
474
+ #
475
+
476
+ # === Get content instances.
477
+ # Get a collection of content instances
219
478
  #
220
479
  # ==== Parameters
221
480
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
222
- def get_products(options = nil)
223
- return @client.get__ecommerce__products(options)
481
+ def get_content_instances(options = nil)
482
+ return @client.raw("get", "/content/instances", options)
224
483
  end
225
484
 
226
- def get_product(id, options = nil)
227
- return @client.get__ecommerce__products(id, options)
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)
228
491
  end
229
492
 
230
- def create_product(data, options = nil)
231
- return @client.create__ecommerce__products(data, options)
493
+ def publish_content_instance(id, data)
494
+ return @client.raw("put", "/content/instances/#{id}/publish", nil, data)
232
495
  end
233
496
 
234
- def update_product(id, data, options = nil)
235
- return @client.update__ecommerce__products(id, data, options)
497
+ def schedule_content_instance(id, data) #FIXME: Undefined index: scheduled_at
498
+ return @client.raw("put", "/content/instances/#{id}/schedule", nil, data)
236
499
  end
237
500
 
238
- # === Get skus.
239
- # Get a collection of skus
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
240
519
  #
241
- # ==== Parameters
242
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
243
- def get_skus(options = nil)
244
- return @client.get__ecommerce__skus(options)
520
+
521
+ def get_authors
522
+ return @client.raw("get", "/content/authors")
245
523
  end
246
524
 
247
- def get_sku(id, options = nil)
248
- return @client.get__ecommerce__skus(id, options)
525
+ def get_keywords(options = nil)
526
+ return @client.raw("get", "/content/keywords", options)
249
527
  end
250
528
 
251
- def create_sku(data, options = nil)
252
- return @client.create__ecommerce__skus(data, options)
529
+ def get_public_images_url
530
+ return @client.raw("get", "/content/public-images-url")
253
531
  end
254
532
 
255
- def update_sku(id, data, options = nil)
256
- return @client.update__ecommerce__skus(id, data, options)
533
+ def get_stages(options = nil)
534
+ return @client.raw("get", "/content/stages", options)
257
535
  end
258
536
 
259
- # === Get prices.
260
- # Get a collection of prices
537
+ ##
538
+ # == dam
261
539
  #
262
- # ==== Parameters
263
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
264
- def get_prices(options = nil)
265
- return @client.get__ecommerce__prices(options)
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)
266
551
  end
267
552
 
268
- def get_price(id, options = nil)
269
- return @client.get__ecommerce__prices(id, options)
553
+ def rename_dam(data) #TODO: No validate
554
+ return @client.raw("post", "/content/dam/rename", nil, data)
270
555
  end
271
556
 
272
- def create_price(data, options = nil)
273
- return @client.create__ecommerce__prices(data, options)
557
+ def search_dam(data)
558
+ return @client.raw("post", "/content/dam/search", nil, data)
274
559
  end
275
560
 
276
- def update_price(id, data, options = nil)
277
- return @client.update__ecommerce__prices(id, data, options)
561
+ def send_to_trash_dam(data) #FIXME: Invalid argument supplied for foreach()
562
+ return @client.raw("post", "/content/dam/sendToTrash", nil, data)
278
563
  end
279
564
 
280
- # === Get prece lists.
281
- # Get a collection of prece lists
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
282
575
  #
283
- # ==== Parameters
284
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
285
- def get_price_lists(options = nil)
286
- return @client.get__ecommerce__price_lists(options)
576
+
577
+ def create_asset(data) #TODO: ask for renaming to 'upload asset'
578
+ return @client.raw("post", "/content/assets/upload", nil, data)
287
579
  end
288
580
 
289
- def get_price_list(id, options = nil)
290
- return @client.get__ecommerce__price_lists(id, options)
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)
291
599
  end
292
600
 
293
- def create_price_list(data, options = nil)
294
- return @client.create__ecommerce__price_lists(data, options)
601
+ def update_asset_variation(id, data) #TODO:
602
+ return @client.raw("post", "/content/assets/updateVariation/#{id}", nil, data)
295
603
  end
296
604
 
297
- def update_price_list(id, data, options = nil)
298
- return @client.update__ecommerce__price_lists(id, data, options)
605
+ def get_asset_sizes(id) #FIXME: wrong number of arguments (given 1, expected 0)
606
+ return @client.raw("get", "/content/assets/sizes/#{id}")
299
607
  end
300
608
 
301
- # === Get product brands.
302
- # Get a collection of product brands
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
303
653
  #
304
- # ==== Parameters
305
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
306
- def get_product_brands(options = nil)
307
- return @client.get__ecommerce__product_brands(options)
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")
308
661
  end
309
662
 
310
- def get_prodict_brand(id, options = nil)
311
- return @client.get__ecommerce__product_brands(id, options)
663
+ def get_story_templates(options = nil)
664
+ return @client.raw("get", "/content/story-templates", options)
312
665
  end
313
666
 
314
- def create_prodict_brand(data, options = nil)
315
- return @client.create__ecommerce__product_brands(data, options)
667
+ def get_story_template(id, options = nil)
668
+ return @client.raw("get", "/content/story-templates/#{id}", options)
316
669
  end
317
670
 
318
- def update_product_brand(id, data, options = nil)
319
- return @client.update__ecommerce__product_brands(id, data, options)
671
+ def create_story_template(data)
672
+ return @client.raw("post", "/content/story-templates", nil, data)
320
673
  end
321
674
 
322
- # === Get product types.
323
- # Get a collection of product types
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
324
681
  #
325
- # ==== Parameters
326
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
327
- def get_product_types(options = nil)
328
- return @client.get__ecommerce__product_types(options)
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)
329
689
  end
330
690
 
331
- def get_prodict_type(id, options = nil)
332
- return @client.get__ecommerce__product_types(id, options)
691
+ def revert_published_story(id)
692
+ return @client.raw("get", "/content/stories/#{id}/revert-published-data")
333
693
  end
334
694
 
335
- def create_prodict_type(data, options = nil)
336
- return @client.create__ecommerce__product_types(data, options)
695
+ def get_story_support_data
696
+ return @client.raw("get", "/content/stories/support-data")
337
697
  end
338
698
 
339
- def update_product_type(id, data, options = nil)
340
- return @client.update__ecommerce__product_types(id, data, options)
699
+ def duplicate_story(id, data)
700
+ return @client.raw("post", "/content/stories/#{id}/duplicate", nil, data)
341
701
  end
342
702
 
343
- # === Get product templates.
344
- # Get a collection of product templates
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
345
725
  #
346
- # ==== Parameters
347
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
348
- def get_product_templates(options = nil)
349
- return @client.get__ecommerce__product_templates(options)
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}")
350
729
  end
351
730
 
352
- def get_prodict_template(id, options = nil)
353
- return @client.get__ecommerce__product_templates(id, options)
731
+ def get_variables_of_content_pages_from_email_template(id)
732
+ return @client.raw("get", "/content/email-templates/content-pages/#{id}/variables")
354
733
  end
355
734
 
356
- def create_prodict_template(data, options = nil)
357
- return @client.create__ecommerce__product_templates(data, options)
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")
358
741
  end
359
742
 
360
- def update_product_template(id, data, options = nil)
361
- return @client.update__ecommerce__product_templates(id, data, options)
743
+ def preview_email_template(data)
744
+ return @client.raw("post", "/content/email-templates/preview", nil, data)
362
745
  end
363
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
364
766
 
365
- # === Get locations.
366
- # Get a collection of locations
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
367
777
  #
368
- # ==== Parameters
369
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
370
- def get_locations(options = nil)
371
- return @client.get__ecommerce__locations(options)
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)
372
789
  end
373
790
 
374
- def get_location(id, options = nil)
375
- return @client.get__ecommerce__locations(id, options)
791
+ ##
792
+ # == Authors
793
+ #
794
+
795
+ def get_author(id)
796
+ return @client.raw("get", "/content/authors/#{id}")
376
797
  end
377
798
 
378
- def create_location(data, options = nil)
379
- return @client.create__ecommerce__locations(data, options)
799
+ def create_author(data)
800
+ return @client.raw("post", "/content/authors", nil, data)
380
801
  end
381
802
 
382
- def update_location(id, data, options = nil)
383
- return @client.update__ecommerce__locations(id, data, options)
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)
384
805
  end
385
-
386
- # === Get taxonomies.
387
- # Get a collection of taxonomies
806
+
807
+ ##
808
+ # == Stages
388
809
  #
389
- # ==== Parameters
390
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
391
- def get_taxonomies(options = nil)
392
- return @client.get__config__taxonomies(options)
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)
393
885
  end
394
886
 
395
- def get_taxonomy(id, options = nil)
396
- return @client.get__config__taxonomies(id, options)
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}")
397
945
  end
398
946
 
399
- def create_taxonomy(data, options = nil)
400
- return @client.create__config__taxonomies(data, options)
947
+ def create_location(data)
948
+ return @client.raw("post", "/ecommerce/locations", nil, data)
401
949
  end
402
950
 
403
- def update_taxonomy(id, data, options = nil)
404
- return @client.update__config__taxonomies(id, data, options)
951
+ def update_location(id, data)
952
+ return @client.raw("put", "/ecommerce/locations/#{id}", nil, data)
405
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
978
+
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
986
+
406
987
  end
407
988
  end