teamlab 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,773 @@
1
+ module Teamlab
2
+ class Crm
3
+
4
+ def initialize
5
+ @request = Teamlab::Request
6
+ end
7
+
8
+ def get_all_opportunity_stages
9
+ @request.get(%w(opportunity stage))
10
+ end
11
+
12
+ def get_currency_list
13
+ @request.get(%w(settings currency))
14
+ end
15
+
16
+ def get_opportunity_list(options = {})
17
+ @request.get(%w(opportunity filter), options)
18
+ end
19
+
20
+ def get_result_of_convertation(options = {})
21
+ @request.get(%w(settings currency convert), options)
22
+ end
23
+
24
+ def get_opportunity_stage(stage_id)
25
+ @request.get(['opportunity', 'stage', stage_id.to_s])
26
+ end
27
+
28
+ def get_opportunity_by_id(id)
29
+ @request.get(['opportunity', id.to_s])
30
+ end
31
+
32
+ def get_all_opportunity_contacts(opportunity_id)
33
+ @request.get(['opportunity', opportunity_id.to_s, 'contact'])
34
+ end
35
+
36
+ def get_summary_table(currency)
37
+ @request.get(['settings', 'currency', currency.to_s, 'summarytable'])
38
+ end
39
+
40
+ def create_opportunity(contact_id, title, responsible_id, options = {})
41
+ @request.post(%w(opportunity), {contactid: contact_id, title: title, responsibleid: responsible_id}.merge(options))
42
+ end
43
+
44
+ def create_opportunity_stage(title, color, options = {})
45
+ @request.post(%w(opportunity stage), { title: title, color: color }.merge(options))
46
+ end
47
+
48
+ def add_opportunity_contact(opportunity_id, contact_id)
49
+ @request.post(['opportunity', opportunity_id.to_s, 'contact', contact_id.to_s])
50
+ end
51
+
52
+ def set_opportunity_success_rights(opportunity_id, is_private, access_list)
53
+ @request.put(%w(opportunity access), opportunityid: opportunity_id, isPrivate: is_private, accessList: access_list)
54
+ end
55
+
56
+ def update_opportunity_stage(id, title, color, options = {})
57
+ @request.put(['opportunity', 'stage', id.to_s], { title: title, color: color, }.merge(options))
58
+ end
59
+
60
+ def update_opportunity_stage_order(options = {})
61
+ @request.put(%w(opportunity stage reorder), options)
62
+ end
63
+
64
+ def set_opportunity_access_rights(options = {})
65
+ @request.put(%w(opportunity filter access), options)
66
+ end
67
+
68
+ def update_opportunity(opportunity_id, contact_id, title, responsible_id, stage_id, options = {})
69
+ @request.put(['opportunity', opportunity_id.to_s], { contactId: contact_id, title: title, responsibleid: responsible_id,
70
+ stageid: stage_id }.merge(options))
71
+ end
72
+
73
+ def update_opportunity_stage_color(stage_id, color)
74
+ @request.put(['opportunity', 'stage', stage_id.to_s, 'color'], { color: color })
75
+ end
76
+
77
+ def set_rights_to_opportunity(opportunity_id, is_private, access_list)
78
+ @request.put(['opportunity', opportunity_id.to_s, 'access'], { isPrivate: is_private, accessList: access_list })
79
+ end
80
+
81
+ def update_opportunity_to_stage(opportunity_id, stage_id)
82
+ @request.put(['opportunity', opportunity_id.to_s, 'stage', stage_id.to_s], stageid: stage_id)
83
+ end
84
+
85
+ def delete_opportunity_group(opportunity_ids)
86
+ @request.delete(%w(opportunity), opportunityids: opportunity_ids)
87
+ end
88
+
89
+ def delete_opportunity_group_by_filter(options = {})
90
+ @request.delete(%w(opportunity filter), options)
91
+ end
92
+
93
+ def delete_opportunity_stage(stage_id)
94
+ @request.delete(['opportunity', 'stage', stage_id.to_s])
95
+ end
96
+
97
+ def delete_opportunity(opportunity_id)
98
+ @request.delete(['opportunity', opportunity_id.to_s])
99
+ end
100
+
101
+ def delete_opportunity_contact(opportunity_id, contact_id)
102
+ @request.delete(['opportunity', opportunity_id.to_s, 'contact', contact_id.to_s])
103
+ end
104
+
105
+ def get_invoice_taxes
106
+ @request.get(%w(invoice tax))
107
+ end
108
+
109
+ def get_contacts_for_mail(contact_ids)
110
+ @request.get(%w(contact mail), contactids: contact_ids)
111
+ end
112
+
113
+ def get_cases_by_prefix(contact_id, prefix)
114
+ @request.get(%w(case byprefix), contactId: contact_id, prefix: prefix)
115
+ end
116
+
117
+ def get_contact_statuses
118
+ @request.get(%w(contact status))
119
+ end
120
+
121
+ def get_invoice_sample
122
+ @request.get(%w(invoice sample))
123
+ end
124
+
125
+ def get_invoices(options = {})
126
+ @request.get(%w(invoice filter), options)
127
+ end
128
+
129
+ def get_contacts(options = {})
130
+ @request.get(%w(contact filter), options)
131
+ end
132
+
133
+ def get_settings
134
+ @request.get(%w(invoice settings))
135
+ end
136
+
137
+ def get_invoice_items(options = {})
138
+ @request.get(%w(invoiceitem filter), options)
139
+ end
140
+
141
+ def get_invoice_by_id(id)
142
+ @request.get(['invoice', id.to_s])
143
+ end
144
+
145
+ def get_simple_contacts(options = {})
146
+ @request.get(%w(contact simple filter), options)
147
+ end
148
+
149
+ def get_contact_status_by_id(contact_status_id)
150
+ @request.get(['contact', 'status', contact_status_id.to_s])
151
+ end
152
+
153
+ def get_entity_invoices(entity_type, entity_id)
154
+ @request.get([entity_type.to_s, 'invoicelist', entity_id.to_s])
155
+ end
156
+
157
+ def create_task(title, deadline, responsible_id, category_id, options = {})
158
+ @request.post(%w(task), {title: title, deadline: deadline, responsibleId: responsible_id, categoryId: category_id}.merge(options))
159
+ end
160
+
161
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
162
+
163
+ def create_invoice(options = {})
164
+ @request.post(%w(invoice), options)
165
+ end
166
+
167
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
168
+
169
+ def create_invoice_line(invoice_id)
170
+ @request.post(%w(invoiceline), invoiceId: invoice_id)
171
+ end
172
+
173
+ def create_invoice_item(options = {})
174
+ @request.post(%w(invoiceitem), options)
175
+ end
176
+
177
+ def create_invoice_tax(name, description, options = {})
178
+ @request.post(%w(invoice tax), {name: name, description: description}.merge(options))
179
+ end
180
+
181
+ def create_contact_type(title, options = {})
182
+ @request.post(%w(contact type), {title: title}.merge(options))
183
+ end
184
+
185
+ def create_contact_status(title, color, options = {})
186
+ @request.post(%w(contact status), {title: title, color: color}.merge(options))
187
+ end
188
+
189
+ def create_person(first_name, last_name, options = {})
190
+ @request.post(%w(contact person), {firstName: first_name, lastName: last_name}.merge(options))
191
+ end
192
+
193
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
194
+
195
+ def create_company(name, options = {})
196
+ @request.post(%w(contact company), {name: name}.merge(options))
197
+ end
198
+
199
+ def create_task_group(title, options = {})
200
+ @request.post(%w(contact task group), {title: title}.merge(options))
201
+ end
202
+
203
+ def add_tag_to_batch_contacts(tags, options = {})
204
+ @request.post(%w(contact filter taglist), {tags: tags}.merge(options))
205
+ end
206
+
207
+ def add_contact_tag_to_group(entity_type, entity_id, tag)
208
+ @request.post([entity_type.to_s, entity_id.to_s, 'tag', 'group'], {tagName: tag})
209
+ end
210
+
211
+ def add_deal_to_contact(contact_id, opportunity_id)
212
+ @request.post(['contact', contact_id.to_s, 'opportunity', opportunity_id.to_s])
213
+ end
214
+
215
+ def set_is_portal_configured(options = {})
216
+ @request.put(%w(settings), options)
217
+ end
218
+
219
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
220
+
221
+ def update_task(task_id, options = {})
222
+ @request.put(['task', task_id.to_s], options)
223
+ end
224
+
225
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
226
+
227
+ def update_invoice_item(id, options = {})
228
+ @request.put(['invoiceitem', id.to_s], options)
229
+ end
230
+
231
+ def update_invoice_tax(id, name, options = {})
232
+ @request.put(['invoice', 'tax', id.to_s], {name: name}.merge(options))
233
+ end
234
+
235
+ def update_contact_type(id, title, options = {})
236
+ @request.put(['contact', 'type', id.to_s], {title: title}.merge(options))
237
+ end
238
+
239
+ def update_contact_status(id, options = {})
240
+ @request.put(['contact', 'status', id.to_s], options)
241
+ end
242
+
243
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
244
+
245
+ def update_invoice(id, options = {})
246
+ @request.put(['invoice', id.to_s], options)
247
+ end
248
+
249
+ def update_crm_contact_tag_setting(options = {})
250
+ @request.put(%w(contact tag settings), options)
251
+ end
252
+
253
+ def set_access_to_batch_contact(options = {})
254
+ @request.put(%w(contact filter access), options)
255
+ end
256
+
257
+ def update_statuses_contact_order(options = {})
258
+ @request.put(%w(contact status reorder), options)
259
+ end
260
+
261
+ def save_terms_settings(options = {})
262
+ @request.put(%w(invoice settings terms), options)
263
+ end
264
+
265
+ def update_crm_contact_status_settings(options = {})
266
+ @request.put(%w(contact status settings), options)
267
+ end
268
+
269
+ def update_invoice_patch_status(status, invoice_ids)
270
+ @request.put(['invoice', 'status', status.to_s], {invoiceids: invoice_ids})
271
+ end
272
+
273
+ def update_contact_status_color(status_id, color)
274
+ @request.put(['contact', 'status', status_id.to_s, 'color'], color: color)
275
+ end
276
+
277
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
278
+
279
+ def update_person(id, options = {})
280
+ @request.put(['contact', 'person', id.to_s], options)
281
+ end
282
+
283
+ def update_contact_status_by_id(contact_id, contact_status_id)
284
+ @request.put(['contact', contact_id, 'status'], {contactStatusid: contact_status_id})
285
+ end
286
+
287
+ def update_invoice_line(invoice_line_id, invoice_id, options = {})
288
+ @request.put(['invoiceline', invoice_line_id], {invoiceId: invoice_id}.merge(options))
289
+ end
290
+
291
+ #=========================================== TODO: MULTIPART-FORM DATA =====================================================
292
+
293
+ def change_contact_photo(contact_id, photo)
294
+ @request.put(['contact', contact_id.to_s, 'changephoto'], {photo: photo})
295
+ end
296
+
297
+ def update_person_and_its_company_status(person_id, contact_status_id)
298
+ @request.put(['contact', 'preson', person_id.to_s, 'status'], contactStatusId: contact_status_id)
299
+ end
300
+
301
+ def update_company_and_participants_status(company_id, contact_status_id)
302
+ @request.put(['contact', 'company', company_id.to_s, 'status'], contactStatusId: contact_status_id)
303
+ end
304
+
305
+ def delete_batch_invoices(*invoice_ids)
306
+ @request.delete(%w(invoice), [invoiceids: invoice_ids.flatten])
307
+ end
308
+
309
+ def delete_batch_items(*ids)
310
+ @request.delete(%w(invoiceitem), ids: ids.flatten)
311
+ end
312
+
313
+ def delete_batch_contacts_by_filter(options = {})
314
+ @request.delete(%w(contact filter), options)
315
+ end
316
+
317
+ def delete_invoice_item(id)
318
+ @request.delete(['invoiceitem', id.to_s])
319
+ end
320
+
321
+ def delete_invoice_tax(id)
322
+ @request.delete(['invoice', 'tax', id.to_s])
323
+ end
324
+
325
+ def delete_invoice(id)
326
+ @request.delete(['invoice', id.to_s])
327
+ end
328
+
329
+ def delete_invoice_line(id)
330
+ @request.delete(['invoiceline', id.to_s])
331
+ end
332
+
333
+ def delete_contact_status(contact_status_id)
334
+ @request.delete('contact', 'status', contact_status_id)
335
+ end
336
+
337
+ def delete_deal_from_contact(contact_id, opportunity_id)
338
+ @request.delete(['contact', contact_id.to_s, 'opportunity', opportunity_id.to_s])
339
+ end
340
+
341
+ def get_event_list_by_filter(options = {})
342
+ @request.get(%w(history filter), options)
343
+ end
344
+
345
+ def get_all_history_categories
346
+ @request.get(%w(history category))
347
+ end
348
+
349
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
350
+
351
+ def create_event(options = {})
352
+ @request.post(%w(history), options)
353
+ end
354
+
355
+ def create_history_category(title, image_name, options = {})
356
+ @request.post(%w(history category), {title: title.to_s, imageName: image_name.to_s}.merge(options))
357
+ end
358
+
359
+ def update_history_category(id, title, options = {})
360
+ @request.put(['history', 'category', id.to_s], {title: title}.merge(options))
361
+ end
362
+
363
+ def update_history_categories_order(*titles)
364
+ @request.put(%w(history category reorder), {titles: titles.flatten})
365
+ end
366
+
367
+ def update_history_category_icon(id, icon_name)
368
+ @request.put(['history', 'category', id.to_s, 'icon'], imageName: icon_name.to_s)
369
+ end
370
+
371
+ def delete_event_and_related_files(id)
372
+ @request.delete(['history', id.to_s])
373
+ end
374
+
375
+ def delete_history_category(id)
376
+ @request.delete(['history', 'category', id.to_s])
377
+ end
378
+
379
+ def get_task_list_by_filter(options = {})
380
+ @request.get(%w(task filter), options)
381
+ end
382
+
383
+ def get_all_task_categories
384
+ @request.get(%w(task category))
385
+ end
386
+
387
+ def get_task_by_id(task_id)
388
+ @request.get(['task', task_id.to_s])
389
+ end
390
+
391
+ def get_task_category(category_id)
392
+ @request.get(['task', 'category', category_id.to_s])
393
+ end
394
+
395
+ def create_task_category(title, image_name, options = {})
396
+ @request.post(%w(task category), {title: title.to_s, imageName: image_name.to_s}.merge(options))
397
+ end
398
+
399
+ def get_contact_upcoming_tasks(contact_id)
400
+ @request.post(%w(contact task near), contactid: contact_id)
401
+ end
402
+
403
+ def update_task_category(category_id, options = {})
404
+ @request.put(['task', 'category', category_id.to_s], options)
405
+ end
406
+
407
+ def close_task(task_id)
408
+ @request.put(['task', task_id.to_s, 'close'])
409
+ end
410
+
411
+ def resume_task(task_id)
412
+ @request.put(['task', task_id.to_s, 'reopen'])
413
+ end
414
+
415
+ def update_task_categories_order(*titles)
416
+ @request.put(%w(task category reorder), titles: titles.flatten)
417
+ end
418
+
419
+ def update_task_category_icon(id, image_name)
420
+ @request.put(['task', 'category', id.to_s, 'icon'], imageName: image_name.to_s)
421
+ end
422
+
423
+ def delete_task(id)
424
+ @request.delete(['task', id.to_s])
425
+ end
426
+
427
+ def delete_task_category(category_id)
428
+ @request.delete(['task', 'category', category_id.to_s])
429
+ end
430
+
431
+ def get_all_contact_types
432
+ @request.get(%w(contact type))
433
+ end
434
+
435
+ def get_contact_by_id(id)
436
+ @request.get(['contact', id.to_s])
437
+ end
438
+
439
+ def get_all_contact_info_types
440
+ @request.get(%w(contact data infotype))
441
+ end
442
+
443
+ def get_contacts_by_project_id(id)
444
+ @request.get(['contact', 'project', id.to_s])
445
+ end
446
+
447
+ def get_contact_type(id)
448
+ @request.get(['contact', 'type', id.to_s])
449
+ end
450
+
451
+ def get_contact_info(contact_id, contact_info_id)
452
+ @request.get(['contact', contact_id.to_s, 'data', contact_info_id.to_s])
453
+ end
454
+
455
+ def get_all_categories(info_type)
456
+ @request.get(['contact', 'data', info_type.to_s, 'category'])
457
+ end
458
+
459
+ def get_company_linked_persons_list(company_id)
460
+ @request.get(['contact', 'company', company_id.to_s, 'person'])
461
+ end
462
+
463
+ def get_contact_information_by_type(contact_id, info_type)
464
+ @request.get(['contact', contact_id.to_s, 'data', info_type.to_s])
465
+ end
466
+
467
+ def group_contact_info(*items)
468
+ @request.post(%w(contact data), items: items.flatten)
469
+ end
470
+
471
+ def quick_person_list_creation(*data)
472
+ @request.post(%w(contact person quick), data: data.flatten)
473
+ end
474
+
475
+ def quick_company_list_creation(*names)
476
+ @request.post(%w(contact company quick), companyName: names.flatten)
477
+ end
478
+
479
+ def add_contact_info(contact_id, infotype, data, category, options = {})
480
+ @request.post(['contact', contact_id.to_s, 'data'], { infoType: infotype, data: data, category: category }.merge(options))
481
+ end
482
+
483
+ def link_contact_list_with_project(project_id, *contact_ids)
484
+ @request.post(['contact', 'project', project_id.to_s], contactId: contact_ids.flatten)
485
+ end
486
+
487
+ def add_persons_to_company(company_id, person_id)
488
+ @request.post(['contact', 'company', company_id.to_s, 'person'], personId: person_id)
489
+ end
490
+
491
+ def link_contact_with_project(contact_id, project_id)
492
+ @request.post(['contact', contact_id.to_s, 'project', project_id.to_s])
493
+ end
494
+
495
+ def add_contact_address(contact_id, category, address, options = {})
496
+ @request.post(['contact', contact_id.to_s, 'data', 'address', category.to_s], {address: address.to_s}.merge(options))
497
+ end
498
+
499
+ def delete_contact_group(*contact_ids)
500
+ @request.put(%w(contact), contactids: contact_ids.flatten)
501
+ end
502
+
503
+ def group_contact_info_update(*items)
504
+ @request.put(%w(contact data), items: items.flatten)
505
+ end
506
+
507
+ def merge_contacts(from_contact_id, to_contact_id)
508
+ @request.put(%w(contact merge), fromcontactid: from_contact_id, tocontactid: to_contact_id)
509
+ end
510
+
511
+ def set_contacts_access_rights(contact_ids, options = {})
512
+ @request.put(%w(contact access), {contactId: contact_ids}.merge(options))
513
+ end
514
+
515
+ def update_contact_types_order(*titles)
516
+ @request.put(%w(contact type reorder), titles: titles.flatten)
517
+ end
518
+
519
+ def set_contact_access_rights(contact_id, options = {})
520
+ @request.put(['contact', contact_id.to_s, 'access'], options)
521
+ end
522
+
523
+ def update_company(company_id, company_name, options = {})
524
+ @request.put(['contact', 'company', company_id.to_s], {companyName: company_name.to_s}.merge(options))
525
+ end
526
+
527
+ def update_contact_info(information_id, contact_id, info_type, data, options = {})
528
+ @request.put(['contact', contact_id.to_s, 'data', information_id.to_s], {infoType: info_type, data: INFO_DATA}.merge(options))
529
+ end
530
+
531
+ def change_contact_photo_by_url(contact_id, photo_url)
532
+ @request.put(['contact', contact_id.to_s, 'changephotobyurl'], photourl: photo_url)
533
+ end
534
+
535
+ def update_contact_address(contact_id, information_record_id, address, options = {})
536
+ @request.put(['contact', contact_id.to_s, 'data', 'address', information_record_id.to_s], {address: address}.merge(options))
537
+ end
538
+
539
+ def delete_contact(id)
540
+ @request.delete(['contact', id.to_s])
541
+ end
542
+
543
+ def delete_contact_type(contact_type_id)
544
+ @request.delete(['contact', 'type', contact_type_id.to_s])
545
+ end
546
+
547
+ def delete_contact_info(contact_id, info_id)
548
+ @request.delete(['contact', contact_id.to_s, 'data', info_id.to_s])
549
+ end
550
+
551
+ def delete_person_from_company(company_id, person_id)
552
+ @request.delete(['contact', 'company', company_id.to_s, 'person'], {personId: person_id})
553
+ end
554
+
555
+ def delete_ontact_address(contact_id, information_record_id)
556
+ @request.delete(['contact', contact_id.to_s, 'data', 'address', information_record_id.to_s])
557
+ end
558
+
559
+ def remove_contact_from_project(contact_id, project_id)
560
+ @request.delete(['contact', contact_id.to_s, 'project', project_id.to_s])
561
+ end
562
+
563
+ def get_root_folder_id
564
+ @request.get(%w(files root))
565
+ end
566
+
567
+ def get_file_list(entity_type, entity_id)
568
+ @request.get([entity_type.to_s, entity_id.to_s, 'files'])
569
+ end
570
+
571
+ def associate_file_with_entity(entity_type, entity_id, *fileids)
572
+ @request.post([entity_type, entity_id, 'files'], files: fileids.flatten)
573
+ end
574
+
575
+ def create_txt(entity_type, entity_id, title, options = {})
576
+ @request.post([entity_type.to_s, entity_id.to_s, 'files', 'text'], {title: title}.merge(options))
577
+ end
578
+
579
+ #================================== TODO: UPLOAD FILES ================================
580
+
581
+ def upload_file(entity_type, entity_id, *files)
582
+ @request.post([entity_type.to_s, entity_id.to_s, 'files', 'upload'], files)
583
+ end
584
+
585
+ def delete_file(id)
586
+ @request.post(['files', id.to_s])
587
+ end
588
+
589
+ def get_tags_for_entity_type(entity_type)
590
+ @request.get([entity_type.to_s, 'tag'])
591
+ end
592
+
593
+ def get_all_contact_tags(contact_id)
594
+ @request.get(['contact', contact_id.to_s, 'tag'])
595
+ end
596
+
597
+ def get_entity_tags(entity_type, entity_id)
598
+ @request.get([entity_type.to_s, 'tag', entity_id.to_s])
599
+ end
600
+
601
+ def create_tag(entity_type, tag_name)
602
+ @request.get([entity_type.to_s, 'tag'], tagName: tag_name)
603
+ end
604
+
605
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
606
+
607
+ def add_tag_to_case_group_by_filter(options = {})
608
+ @request.post(%w(case filter taglist), options)
609
+ end
610
+
611
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
612
+
613
+ def add_tag_group_to_entity(entity_type, entity_id, tag_name)
614
+ @request.post([entity_type.to_s, 'taglist'], entityId: entity_id, tagName: tag_name)
615
+ end
616
+
617
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
618
+
619
+ def add_tag_to_opportunity_group(options = {})
620
+ @request.post(%w(opportunity filter taglist), options)
621
+ end
622
+
623
+ def add_tag(entity_type, entity_id, tag_name)
624
+ @request.post([entity_type.to_s, entity_id.to_s, 'tag'], tagName: tag_name)
625
+ end
626
+
627
+ def delete_tag(entity_type, tag_name)
628
+ @request.delete([entity_type.to_s, 'tag'], tagName: tag_name)
629
+ end
630
+
631
+ def delete_unused_tags(entity_type)
632
+ @request.delete([entity_type.to_s, 'tag', 'unused'])
633
+ end
634
+
635
+ def remove_tag(entity_type, entity_id, tag_name)
636
+ @request.delete([entity_type.to_s, entity_id.to_s, 'tag'], tagName: tag_name)
637
+ end
638
+
639
+ def get_task_template_container_list(entity_type)
640
+ @request.get([entity_type.to_s, 'tasktemplatecontainer'])
641
+ end
642
+
643
+ def get_task_template_container(id)
644
+ @request.get(['tasktemplatecontainer', id.to_s])
645
+ end
646
+
647
+ def get_task_template(id)
648
+ @request.get(['tasktemplatecontainer', 'tasktemplate', id.to_s])
649
+ end
650
+
651
+ def get_task_template_list_by_container_id(id)
652
+ @request.get(['tasktemplatecontainer', id.to_s, 'tasktemplate'])
653
+ end
654
+
655
+ def create_task_template_container(entity_type, title)
656
+ @request.post([entity_type.to_s, 'tasktemplatecontainer'], title: title)
657
+ end
658
+
659
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
660
+
661
+ def create_task_template(container_id, title, options = {})
662
+ @request.post(['tasktemplatecontainer', container_id.to_s, 'tasktemplate'], {title: title}.merge(options))
663
+ end
664
+
665
+ def update_task_template_container(container_id, title)
666
+ @request.put(['tasktemplatecontainer', container_id.to_s], title: title)
667
+ end
668
+
669
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
670
+
671
+ def update_task_template(container_id, task_template_id, options = {})
672
+ @request.put(['tasktemplatecontainer', container_id.to_s, 'tasktemplate'], {id: task_template_id.to_s}.merge(options))
673
+ end
674
+
675
+ def delete_task_template_container(container_id)
676
+ @request.delete(['tasktemplatecontainer', container_id.to_s])
677
+ end
678
+
679
+ def delete_task_template(id)
680
+ @request.delete(['tasktemplatecontainer', 'tasktemplate', id.to_s])
681
+ end
682
+
683
+ #=========================================== TODO: OPTIONAL VARIABLES =====================================================
684
+
685
+ def get_case_list(options = {})
686
+ @request.get(%w(case filter), options)
687
+ end
688
+
689
+ def get_case_by_id(id)
690
+ @request.get(['case', id.to_s])
691
+ end
692
+
693
+ def get_all_case_contacts(case_id)
694
+ @request.get(['case', case_id.to_s, 'contact'])
695
+ end
696
+
697
+ def create_case(title, options = {})
698
+ @request.post(%w(case), {title: title}.merge(options))
699
+ end
700
+
701
+ def add_case_contact(case_id, contact_id)
702
+ @request.post(['case', case_id.to_s, 'contact'], contactId: contact_id)
703
+ end
704
+
705
+ def set_case_access_rights(case_id, options = {})
706
+ @request.put(%w(case access), {caseId: case_id}.merge(options))
707
+ end
708
+
709
+ def update_case(case_id, title, options = {})
710
+ @request.put(['case', case_id.to_s], {title: title}.merge(options))
711
+ end
712
+
713
+ def set_case_access_rights_by_filter(options = {})
714
+ @request.put(%w(case filter access), options)
715
+ end
716
+
717
+ def resume_case(case_id)
718
+ @request.put(['case', case_id.to_s, 'reopen'])
719
+ end
720
+
721
+ def close_case(case_id)
722
+ @request.put(['case', case_id.to_s, 'close'])
723
+ end
724
+
725
+ def set_rights_to_case(case_id, options = {})
726
+ @request.put(['case', case_id.to_s, 'access'], options)
727
+ end
728
+
729
+ def delete_case_group(*case_ids)
730
+ @request.delete(%w(case), caseIds: case_ids.flatten)
731
+ end
732
+
733
+ def delete_case_group_by_filter(options = {})
734
+ @request.delete(%w(case filter), options)
735
+ end
736
+
737
+ def delete_case(case_id)
738
+ @request.delete(['case', case_id.to_s])
739
+ end
740
+
741
+ def delete_case_contact(case_id, contact_id)
742
+ @request.delete(['case', case_id.to_s, 'contact', contact_id.to_s])
743
+ end
744
+
745
+ def get_user_field_values(entity_type, entity_id)
746
+ @request.get([entity_type.to_s, entity_id.to_s, 'customfield'])
747
+ end
748
+
749
+ def get_user_field_list(entity_type)
750
+ @request.get([entity_type.to_s, 'customfield', 'definitions'])
751
+ end
752
+
753
+ def create_user_field(entity_type, field_type, options = {})
754
+ @request.post([entity_type.to_s, 'customfield'], {fieldType: field_type}.merge(options))
755
+ end
756
+
757
+ def set_user_field_value(entity_type, entity_id, field_id, field_value)
758
+ @request.post([entity_type.to_s, entity_id.to_s, 'customfield', field_id.to_s], fieldValue: field_value)
759
+ end
760
+
761
+ def update_selected_user_field(entity_type, user_field_id, field_type, options = {})
762
+ @request.put([entity_type.to_s, 'customfield', user_field_id.to_s], {fieldType: field_type}.merge(options))
763
+ end
764
+
765
+ def update_user_fields_order(entity_type, *field_ids)
766
+ @request.put([entity_type.to_s, 'customfield', 'reorder'], {fieldIds: field_ids.flatten})
767
+ end
768
+
769
+ def delete_user_field(entity_type, field_id)
770
+ @request.delete([entity_type.to_s, 'customfield', field_id.to_s])
771
+ end
772
+ end
773
+ end