Class: Teamlab::Crm

Inherits:
Object
  • Object
show all
Defined in:
lib/teamlab/modules/crm.rb

Instance Method Summary collapse

Constructor Details

#initializeCrm

Returns a new instance of Crm.



3
4
5
# File 'lib/teamlab/modules/crm.rb', line 3

def initialize
  @request = Teamlab::Request.new('crm')
end

Instance Method Details

#add_case_contact(case_id, contact_id) ⇒ Object



711
712
713
# File 'lib/teamlab/modules/crm.rb', line 711

def add_case_contact(case_id, contact_id)
  @request.post(['case', case_id.to_s, 'contact'], contactId: contact_id)
end

#add_contact_address(contact_id, category, address, options = {}) ⇒ Object



507
508
509
# File 'lib/teamlab/modules/crm.rb', line 507

def add_contact_address(contact_id, category, address, options = {})
  @request.post(['contact', contact_id.to_s, 'data', 'address', category.to_s], { address: address.to_s }.merge(options))
end

#add_contact_info(contact_id, infotype, data, category, options = {}) ⇒ Object



491
492
493
# File 'lib/teamlab/modules/crm.rb', line 491

def add_contact_info(contact_id, infotype, data, category, options = {})
  @request.post(['contact', contact_id.to_s, 'data'], { infoType: infotype, data: data, category: category }.merge(options))
end

#add_contact_tag_to_group(entity_type, entity_id, tag) ⇒ Object



207
208
209
# File 'lib/teamlab/modules/crm.rb', line 207

def add_contact_tag_to_group(entity_type, entity_id, tag)
  @request.post([entity_type.to_s, entity_id.to_s, 'tag', 'group'], tagName: tag)
end

#add_deal_to_contact(contact_id, opportunity_id) ⇒ Object



211
212
213
# File 'lib/teamlab/modules/crm.rb', line 211

def add_deal_to_contact(contact_id, opportunity_id)
  @request.post(['contact', contact_id.to_s, 'opportunity', opportunity_id.to_s])
end

#add_opportunity_contact(opportunity_id, contact_id) ⇒ Object



48
49
50
# File 'lib/teamlab/modules/crm.rb', line 48

def add_opportunity_contact(opportunity_id, contact_id)
  @request.post(['opportunity', opportunity_id.to_s, 'contact', contact_id.to_s])
end

#add_persons_to_company(company_id, person_id) ⇒ Object



499
500
501
# File 'lib/teamlab/modules/crm.rb', line 499

def add_persons_to_company(company_id, person_id)
  @request.post(['contact', 'company', company_id.to_s, 'person'], personId: person_id)
end

#add_tag(entity_type, entity_id, tag_name) ⇒ Object



635
636
637
# File 'lib/teamlab/modules/crm.rb', line 635

def add_tag(entity_type, entity_id, tag_name)
  @request.post([entity_type.to_s, entity_id.to_s, 'tag'], tagName: tag_name)
end

#add_tag_group_to_entity(entity_type, entity_id, tag_name) ⇒ Object

TODO: OPTIONAL VARIABLES =====================================================


625
626
627
# File 'lib/teamlab/modules/crm.rb', line 625

def add_tag_group_to_entity(entity_type, entity_id, tag_name)
  @request.post([entity_type.to_s, 'taglist'], entityId: entity_id, tagName: tag_name)
end

#add_tag_to_batch_contacts(tags, options = {}) ⇒ Object



203
204
205
# File 'lib/teamlab/modules/crm.rb', line 203

def add_tag_to_batch_contacts(tags, options = {})
  @request.post(%w(contact filter taglist), { tags: tags }.merge(options))
end

#add_tag_to_case_group_by_filter(tag_name, options = {}) ⇒ Object

TODO: OPTIONAL VARIABLES =====================================================


619
620
621
# File 'lib/teamlab/modules/crm.rb', line 619

def add_tag_to_case_group_by_filter(tag_name, options = {})
  @request.post(%w(case filter taglist), { tagName: tag_name }.merge(options))
end

#add_tag_to_opportunity_group(tag_name, options = {}) ⇒ Object

TODO: OPTIONAL VARIABLES =====================================================


631
632
633
# File 'lib/teamlab/modules/crm.rb', line 631

def add_tag_to_opportunity_group(tag_name, options = {})
  @request.post(%w(opportunity filter taglist), { tagName: tag_name }.merge(options))
end

#associate_file_with_entity(entity_type, entity_id, *fileids) ⇒ Object



585
586
587
# File 'lib/teamlab/modules/crm.rb', line 585

def associate_file_with_entity(entity_type, entity_id, *fileids)
  @request.post([entity_type, entity_id, 'files'], files: fileids.flatten)
end

#change_contact_photo(contact_id, photo) ⇒ Object

TODO: MULTIPART-FORM DATA =====================================================


307
308
309
# File 'lib/teamlab/modules/crm.rb', line 307

def change_contact_photo(contact_id, photo)
  @request.put(['contact', contact_id.to_s, 'changephoto'], photo: photo)
end

#change_contact_photo_by_url(contact_id, photo_url) ⇒ Object



543
544
545
# File 'lib/teamlab/modules/crm.rb', line 543

def change_contact_photo_by_url(contact_id, photo_url)
  @request.put(['contact', contact_id.to_s, 'changephotobyurl'], photourl: photo_url)
end

#close_case(case_id) ⇒ Object



731
732
733
# File 'lib/teamlab/modules/crm.rb', line 731

def close_case(case_id)
  @request.put(['case', case_id.to_s, 'close'])
end

#close_task(task_id) ⇒ Object



419
420
421
# File 'lib/teamlab/modules/crm.rb', line 419

def close_task(task_id)
  @request.put(['task', task_id.to_s, 'close'])
end

#create_case(title, options = {}) ⇒ Object



707
708
709
# File 'lib/teamlab/modules/crm.rb', line 707

def create_case(title, options = {})
  @request.post(%w(case), { title: title }.merge(options))
end

#create_company(company_name, managers, options = {}) ⇒ Object



195
196
197
# File 'lib/teamlab/modules/crm.rb', line 195

def create_company(company_name, managers, options = {})
  @request.post(%w(contact company), { companyName: company_name, managerList: managers }.merge(options))
end

#create_contact_status(title, color, options = {}) ⇒ Object



187
188
189
# File 'lib/teamlab/modules/crm.rb', line 187

def create_contact_status(title, color, options = {})
  @request.post(%w(contact status), { title: title, color: color }.merge(options))
end

#create_contact_type(title, options = {}) ⇒ Object



183
184
185
# File 'lib/teamlab/modules/crm.rb', line 183

def create_contact_type(title, options = {})
  @request.post(%w(contact type), { title: title }.merge(options))
end

#create_event(contact_id, content, category_id, options = {}) ⇒ Object



363
364
365
# File 'lib/teamlab/modules/crm.rb', line 363

def create_event(contact_id, content, category_id, options = {})
  @request.post(%w(history), { contactId: contact_id, content: content, categoryId: category_id }.merge(options))
end

#create_history_category(title, image_name, options = {}) ⇒ Object



367
368
369
# File 'lib/teamlab/modules/crm.rb', line 367

def create_history_category(title, image_name, options = {})
  @request.post(%w(history category), { title: title.to_s, imageName: image_name.to_s }.merge(options))
end

#create_invoice(number, issue_date, client_id, due_date, language, currency, exchange_rate, terms, invoice_line, options) ⇒ Object



165
166
167
168
169
# File 'lib/teamlab/modules/crm.rb', line 165

def create_invoice(number, issue_date, client_id, due_date, language, currency, exchange_rate, terms, invoice_line, options)
  @request.post(%w(invoice), {number: number, issueDate: issue_date, contactId: client_id, dueDate: due_date,
                              language: language, currency: currency, exchangeRate: exchange_rate, terms: terms,
                              invoiceLines: invoice_line}.merge(options))
end

#create_invoice_item(title, description, price, stock_keeping_unit, options = {}) ⇒ Object



175
176
177
# File 'lib/teamlab/modules/crm.rb', line 175

def create_invoice_item(title, description, price, stock_keeping_unit, options = {})
  @request.post(%w(invoiceitem), { title: title, description: description, price: price, sku: stock_keeping_unit.to_s }.merge(options))
end

#create_invoice_line(invoice_id, options = {}) ⇒ Object



171
172
173
# File 'lib/teamlab/modules/crm.rb', line 171

def create_invoice_line(invoice_id, options = {})
  @request.post(%w(invoiceline), { invoiceId: invoice_id }.merge(options))
end

#create_invoice_tax(name, description, options = {}) ⇒ Object



179
180
181
# File 'lib/teamlab/modules/crm.rb', line 179

def create_invoice_tax(name, description, options = {})
  @request.post(%w(invoice tax), { name: name, description: description }.merge(options))
end

#create_opportunity(stage_id, title, responsible_id, options = {}) ⇒ Object



40
41
42
# File 'lib/teamlab/modules/crm.rb', line 40

def create_opportunity(stage_id, title, responsible_id, options = {})
  @request.post(%w(opportunity), { stageId: stage_id, title: title, responsibleid: responsible_id }.merge(options))
end

#create_opportunity_stage(title, color, options = {}) ⇒ Object



44
45
46
# File 'lib/teamlab/modules/crm.rb', line 44

def create_opportunity_stage(title, color, options = {})
  @request.post(%w(opportunity stage), { title: title, color: color }.merge(options))
end

#create_person(first_name, last_name, options = {}) ⇒ Object



191
192
193
# File 'lib/teamlab/modules/crm.rb', line 191

def create_person(first_name, last_name, options = {})
  @request.post(%w(contact person), { firstName: first_name, lastName: last_name }.merge(options))
end

#create_tag(entity_type, tag_name) ⇒ Object



613
614
615
# File 'lib/teamlab/modules/crm.rb', line 613

def create_tag(entity_type, tag_name)
  @request.post([entity_type.to_s, 'tag'], tagName: tag_name)
end

#create_task(title, deadline, responsible_id, category_id, options = {}) ⇒ Object



161
162
163
# File 'lib/teamlab/modules/crm.rb', line 161

def create_task(title, deadline, responsible_id, category_id, options = {})
  @request.post(%w(task), { title: title, deadline: deadline, responsibleId: responsible_id, categoryId: category_id }.merge(options))
end

#create_task_category(title, image_name, options = {}) ⇒ Object



407
408
409
# File 'lib/teamlab/modules/crm.rb', line 407

def create_task_category(title, image_name, options = {})
  @request.post(%w(task category), { title: title.to_s, imageName: image_name.to_s }.merge(options))
end

#create_task_group(title, options = {}) ⇒ Object



199
200
201
# File 'lib/teamlab/modules/crm.rb', line 199

def create_task_group(title, options = {})
  @request.post(%w(contact task group), { title: title }.merge(options))
end

#create_task_template(container_id, title, options = {}) ⇒ Object

TODO: OPTIONAL VARIABLES =====================================================


673
674
675
# File 'lib/teamlab/modules/crm.rb', line 673

def create_task_template(container_id, title, options = {})
  @request.post(['tasktemplatecontainer', container_id.to_s, 'tasktemplate'], { title: title }.merge(options))
end

#create_task_template_container(entity_type, title) ⇒ Object



667
668
669
# File 'lib/teamlab/modules/crm.rb', line 667

def create_task_template_container(entity_type, title)
  @request.post([entity_type.to_s, 'tasktemplatecontainer'], title: title)
end

#create_txt(entity_type, entity_id, title, content) ⇒ Object



589
590
591
# File 'lib/teamlab/modules/crm.rb', line 589

def create_txt(entity_type, entity_id, title, content)
  @request.post([entity_type.to_s, entity_id.to_s, 'files', 'text'], title: title, content: content)
end

#create_user_field(entity_type, label, field_type, options = {}) ⇒ Object



763
764
765
# File 'lib/teamlab/modules/crm.rb', line 763

def create_user_field(entity_type, label, field_type, options = {})
  @request.post([entity_type.to_s, 'customfield'], { fieldType: field_type, label: label }.merge(options))
end

#delete_batch_contacts_by_filter(options = {}) ⇒ Object



327
328
329
# File 'lib/teamlab/modules/crm.rb', line 327

def delete_batch_contacts_by_filter(options = {})
  @request.delete(%w(contact filter), options)
end

#delete_batch_invoices(*invoice_ids) ⇒ Object



319
320
321
# File 'lib/teamlab/modules/crm.rb', line 319

def delete_batch_invoices(*invoice_ids)
  @request.delete(%w(invoice), [invoiceids: invoice_ids.flatten])
end

#delete_batch_items(*ids) ⇒ Object



323
324
325
# File 'lib/teamlab/modules/crm.rb', line 323

def delete_batch_items(*ids)
  @request.delete(%w(invoiceitem), ids: ids.flatten)
end

#delete_case(case_id) ⇒ Object



747
748
749
# File 'lib/teamlab/modules/crm.rb', line 747

def delete_case(case_id)
  @request.delete(['case', case_id.to_s])
end

#delete_case_contact(case_id, contact_id) ⇒ Object



751
752
753
# File 'lib/teamlab/modules/crm.rb', line 751

def delete_case_contact(case_id, contact_id)
  @request.delete(['case', case_id.to_s, 'contact', contact_id.to_s])
end

#delete_case_group(*case_ids) ⇒ Object



739
740
741
# File 'lib/teamlab/modules/crm.rb', line 739

def delete_case_group(*case_ids)
  @request.delete(%w(case), caseIds: case_ids.flatten)
end

#delete_case_group_by_filter(options = {}) ⇒ Object



743
744
745
# File 'lib/teamlab/modules/crm.rb', line 743

def delete_case_group_by_filter(options = {})
  @request.delete(%w(case filter), options)
end

#delete_contact(id) ⇒ Object



551
552
553
# File 'lib/teamlab/modules/crm.rb', line 551

def delete_contact(id)
  @request.delete(['contact', id.to_s])
end

#delete_contact_address(contact_id, information_id) ⇒ Object



567
568
569
# File 'lib/teamlab/modules/crm.rb', line 567

def delete_contact_address(contact_id, information_id)
  @request.delete(['contact', contact_id.to_s, 'data', 'address', information_id.to_s])
end

#delete_contact_group(*contact_ids) ⇒ Object



511
512
513
# File 'lib/teamlab/modules/crm.rb', line 511

def delete_contact_group(*contact_ids)
  @request.put(%w(contact), contactids: contact_ids.flatten)
end

#delete_contact_info(contact_id, info_id) ⇒ Object



559
560
561
# File 'lib/teamlab/modules/crm.rb', line 559

def delete_contact_info(contact_id, info_id)
  @request.delete(['contact', contact_id.to_s, 'data', info_id.to_s])
end

#delete_contact_status(contact_status_id) ⇒ Object



347
348
349
# File 'lib/teamlab/modules/crm.rb', line 347

def delete_contact_status(contact_status_id)
  @request.delete('contact', 'status', contact_status_id)
end

#delete_contact_type(contact_type_id) ⇒ Object



555
556
557
# File 'lib/teamlab/modules/crm.rb', line 555

def delete_contact_type(contact_type_id)
  @request.delete(['contact', 'type', contact_type_id.to_s])
end

#delete_deal_from_contact(contact_id, opportunity_id) ⇒ Object



351
352
353
# File 'lib/teamlab/modules/crm.rb', line 351

def delete_deal_from_contact(contact_id, opportunity_id)
  @request.delete(['contact', contact_id.to_s, 'opportunity', opportunity_id.to_s])
end


383
384
385
# File 'lib/teamlab/modules/crm.rb', line 383

def delete_event_and_related_files(id)
  @request.delete(['history', id.to_s])
end

#delete_file(id) ⇒ Object



597
598
599
# File 'lib/teamlab/modules/crm.rb', line 597

def delete_file(id)
  @request.post(['files', id.to_s])
end

#delete_history_category(id) ⇒ Object



387
388
389
# File 'lib/teamlab/modules/crm.rb', line 387

def delete_history_category(id)
  @request.delete(['history', 'category', id.to_s])
end

#delete_invoice(id) ⇒ Object



339
340
341
# File 'lib/teamlab/modules/crm.rb', line 339

def delete_invoice(id)
  @request.delete(['invoice', id.to_s])
end

#delete_invoice_item(id) ⇒ Object



331
332
333
# File 'lib/teamlab/modules/crm.rb', line 331

def delete_invoice_item(id)
  @request.delete(['invoiceitem', id.to_s])
end

#delete_invoice_line(id) ⇒ Object



343
344
345
# File 'lib/teamlab/modules/crm.rb', line 343

def delete_invoice_line(id)
  @request.delete(['invoiceline', id.to_s])
end

#delete_invoice_tax(id) ⇒ Object



335
336
337
# File 'lib/teamlab/modules/crm.rb', line 335

def delete_invoice_tax(id)
  @request.delete(['invoice', 'tax', id.to_s])
end

#delete_opportunity(opportunity_id) ⇒ Object



97
98
99
# File 'lib/teamlab/modules/crm.rb', line 97

def delete_opportunity(opportunity_id)
  @request.delete(['opportunity', opportunity_id.to_s])
end

#delete_opportunity_contact(opportunity_id, contact_id) ⇒ Object



101
102
103
# File 'lib/teamlab/modules/crm.rb', line 101

def delete_opportunity_contact(opportunity_id, contact_id)
  @request.delete(['opportunity', opportunity_id.to_s, 'contact', contact_id.to_s])
end

#delete_opportunity_group(*opportunity_ids) ⇒ Object



85
86
87
# File 'lib/teamlab/modules/crm.rb', line 85

def delete_opportunity_group(*opportunity_ids)
  @request.delete(%w(opportunity), opportunityids: opportunity_ids.flatten)
end

#delete_opportunity_group_by_filter(options = {}) ⇒ Object



89
90
91
# File 'lib/teamlab/modules/crm.rb', line 89

def delete_opportunity_group_by_filter(options = {})
  @request.delete(%w(opportunity filter), options)
end

#delete_opportunity_stage(stage_id) ⇒ Object



93
94
95
# File 'lib/teamlab/modules/crm.rb', line 93

def delete_opportunity_stage(stage_id)
  @request.delete(['opportunity', 'stage', stage_id.to_s])
end

#delete_person_from_company(company_id, person_id) ⇒ Object



563
564
565
# File 'lib/teamlab/modules/crm.rb', line 563

def delete_person_from_company(company_id, person_id)
  @request.delete(['contact', 'company', company_id.to_s, 'person'], personId: person_id)
end

#delete_tag(entity_type, tag_name) ⇒ Object



639
640
641
# File 'lib/teamlab/modules/crm.rb', line 639

def delete_tag(entity_type, tag_name)
  @request.delete([entity_type.to_s, 'tag'], tagName: tag_name)
end

#delete_task(id) ⇒ Object



435
436
437
# File 'lib/teamlab/modules/crm.rb', line 435

def delete_task(id)
  @request.delete(['task', id.to_s])
end

#delete_task_category(category_id) ⇒ Object



439
440
441
# File 'lib/teamlab/modules/crm.rb', line 439

def delete_task_category(category_id)
  @request.delete(['task', 'category', category_id.to_s])
end

#delete_task_template(id) ⇒ Object



691
692
693
# File 'lib/teamlab/modules/crm.rb', line 691

def delete_task_template(id)
  @request.delete(['tasktemplatecontainer', 'tasktemplate', id.to_s])
end

#delete_task_template_container(container_id) ⇒ Object



687
688
689
# File 'lib/teamlab/modules/crm.rb', line 687

def delete_task_template_container(container_id)
  @request.delete(['tasktemplatecontainer', container_id.to_s])
end

#delete_unused_tags(entity_type) ⇒ Object



643
644
645
# File 'lib/teamlab/modules/crm.rb', line 643

def delete_unused_tags(entity_type)
  @request.delete([entity_type.to_s, 'tag', 'unused'])
end

#delete_user_field(entity_type, field_id) ⇒ Object



779
780
781
# File 'lib/teamlab/modules/crm.rb', line 779

def delete_user_field(entity_type, field_id)
  @request.delete([entity_type.to_s, 'customfield', field_id.to_s])
end

#get_all_case_contacts(case_id) ⇒ Object



703
704
705
# File 'lib/teamlab/modules/crm.rb', line 703

def get_all_case_contacts(case_id)
  @request.get(['case', case_id.to_s, 'contact'])
end

#get_all_categories(info_type) ⇒ Object



467
468
469
# File 'lib/teamlab/modules/crm.rb', line 467

def get_all_categories(info_type)
  @request.get(['contact', 'data', info_type.to_s, 'category'])
end

#get_all_contact_info_typesObject



451
452
453
# File 'lib/teamlab/modules/crm.rb', line 451

def get_all_contact_info_types
  @request.get(%w(contact data infotype))
end

#get_all_contact_tags(contact_id) ⇒ Object



605
606
607
# File 'lib/teamlab/modules/crm.rb', line 605

def get_all_contact_tags(contact_id)
  @request.get(['contact', contact_id.to_s, 'tag'])
end

#get_all_contact_typesObject



443
444
445
# File 'lib/teamlab/modules/crm.rb', line 443

def get_all_contact_types
  @request.get(%w(contact type))
end

#get_all_history_categoriesObject



359
360
361
# File 'lib/teamlab/modules/crm.rb', line 359

def get_all_history_categories
  @request.get(%w(history category))
end

#get_all_opportunity_contacts(opportunity_id) ⇒ Object



32
33
34
# File 'lib/teamlab/modules/crm.rb', line 32

def get_all_opportunity_contacts(opportunity_id)
  @request.get(['opportunity', opportunity_id.to_s, 'contact'])
end

#get_all_opportunity_stagesObject

region Opportunity



8
9
10
# File 'lib/teamlab/modules/crm.rb', line 8

def get_all_opportunity_stages
  @request.get(%w(opportunity stage))
end

#get_all_task_categoriesObject



395
396
397
# File 'lib/teamlab/modules/crm.rb', line 395

def get_all_task_categories
  @request.get(%w(task category))
end

#get_case_by_id(id) ⇒ Object



699
700
701
# File 'lib/teamlab/modules/crm.rb', line 699

def get_case_by_id(id)
  @request.get(['case', id.to_s])
end

#get_case_list(options = {}) ⇒ Object



695
696
697
# File 'lib/teamlab/modules/crm.rb', line 695

def get_case_list(options = {})
  @request.get(%w(case filter), options)
end

#get_cases_by_prefix(contact_id, prefix) ⇒ Object



117
118
119
# File 'lib/teamlab/modules/crm.rb', line 117

def get_cases_by_prefix(contact_id, prefix)
  @request.get(%w(case byprefix), contactId: contact_id, prefix: prefix)
end

#get_company_linked_persons_list(company_id) ⇒ Object



471
472
473
# File 'lib/teamlab/modules/crm.rb', line 471

def get_company_linked_persons_list(company_id)
  @request.get(['contact', 'company', company_id.to_s, 'person'])
end

#get_contact_by_id(id) ⇒ Object



447
448
449
# File 'lib/teamlab/modules/crm.rb', line 447

def get_contact_by_id(id)
  @request.get(['contact', id.to_s])
end

#get_contact_info(contact_id, contact_info_id) ⇒ Object



463
464
465
# File 'lib/teamlab/modules/crm.rb', line 463

def get_contact_info(contact_id, contact_info_id)
  @request.get(['contact', contact_id.to_s, 'data', contact_info_id.to_s])
end

#get_contact_information_by_type(contact_id, info_type) ⇒ Object



475
476
477
# File 'lib/teamlab/modules/crm.rb', line 475

def get_contact_information_by_type(contact_id, info_type)
  @request.get(['contact', contact_id.to_s, 'data', info_type.to_s])
end

#get_contact_status_by_id(contact_status_id) ⇒ Object



153
154
155
# File 'lib/teamlab/modules/crm.rb', line 153

def get_contact_status_by_id(contact_status_id)
  @request.get(['contact', 'status', contact_status_id.to_s])
end

#get_contact_statusesObject



121
122
123
# File 'lib/teamlab/modules/crm.rb', line 121

def get_contact_statuses
  @request.get(%w(contact status))
end

#get_contact_type(id) ⇒ Object



459
460
461
# File 'lib/teamlab/modules/crm.rb', line 459

def get_contact_type(id)
  @request.get(['contact', 'type', id.to_s])
end

#get_contact_upcoming_tasks(*contact_ids) ⇒ Object



411
412
413
# File 'lib/teamlab/modules/crm.rb', line 411

def get_contact_upcoming_tasks(*contact_ids)
  @request.post(%w(contact task near), contactid: contact_ids.flatten)
end

#get_contacts_by_filter(options = {}) ⇒ Object



133
134
135
# File 'lib/teamlab/modules/crm.rb', line 133

def get_contacts_by_filter(options = {})
  @request.get(%w(contact filter), options)
end

#get_contacts_by_project_id(id) ⇒ Object



455
456
457
# File 'lib/teamlab/modules/crm.rb', line 455

def get_contacts_by_project_id(id)
  @request.get(['contact', 'project', id.to_s])
end

#get_contacts_for_mail(*contact_ids) ⇒ Object



113
114
115
# File 'lib/teamlab/modules/crm.rb', line 113

def get_contacts_for_mail(*contact_ids)
  @request.get(%w(contact mail), contactids: contact_ids.flatten)
end

#get_currency_listObject



12
13
14
# File 'lib/teamlab/modules/crm.rb', line 12

def get_currency_list
  @request.get(%w(settings currency))
end

#get_entity_invoices(entity_type, entity_id) ⇒ Object



157
158
159
# File 'lib/teamlab/modules/crm.rb', line 157

def get_entity_invoices(entity_type, entity_id)
  @request.get([entity_type.to_s, 'invoicelist', entity_id.to_s])
end

#get_entity_tags(entity_type, entity_id) ⇒ Object



609
610
611
# File 'lib/teamlab/modules/crm.rb', line 609

def get_entity_tags(entity_type, entity_id)
  @request.get([entity_type.to_s, 'tag', entity_id.to_s])
end

#get_event_list_by_filter(options = {}) ⇒ Object



355
356
357
# File 'lib/teamlab/modules/crm.rb', line 355

def get_event_list_by_filter(options = {})
  @request.get(%w(history filter), options)
end

#get_file_list(entity_type, entity_id) ⇒ Object



581
582
583
# File 'lib/teamlab/modules/crm.rb', line 581

def get_file_list(entity_type, entity_id)
  @request.get([entity_type.to_s, entity_id.to_s, 'files'])
end

#get_invoice_by_id(id) ⇒ Object



145
146
147
# File 'lib/teamlab/modules/crm.rb', line 145

def get_invoice_by_id(id)
  @request.get(['invoice', id.to_s])
end

#get_invoice_items_by_filter(options = {}) ⇒ Object



141
142
143
# File 'lib/teamlab/modules/crm.rb', line 141

def get_invoice_items_by_filter(options = {})
  @request.get(%w(invoiceitem filter), options)
end

#get_invoice_sampleObject



125
126
127
# File 'lib/teamlab/modules/crm.rb', line 125

def get_invoice_sample
  @request.get(%w(invoice sample))
end

#get_invoice_taxesObject

region General



109
110
111
# File 'lib/teamlab/modules/crm.rb', line 109

def get_invoice_taxes
  @request.get(%w(invoice tax))
end

#get_invoices_by_filter(options = {}) ⇒ Object



129
130
131
# File 'lib/teamlab/modules/crm.rb', line 129

def get_invoices_by_filter(options = {})
  @request.get(%w(invoice filter), options)
end

#get_opportunity_by_id(id) ⇒ Object



28
29
30
# File 'lib/teamlab/modules/crm.rb', line 28

def get_opportunity_by_id(id)
  @request.get(['opportunity', id.to_s])
end

#get_opportunity_list(options = {}) ⇒ Object



16
17
18
# File 'lib/teamlab/modules/crm.rb', line 16

def get_opportunity_list(options = {})
  @request.get(%w(opportunity filter), options)
end

#get_opportunity_stage(stage_id) ⇒ Object



24
25
26
# File 'lib/teamlab/modules/crm.rb', line 24

def get_opportunity_stage(stage_id)
  @request.get(['opportunity', 'stage', stage_id.to_s])
end

#get_result_of_convertation(options = {}) ⇒ Object



20
21
22
# File 'lib/teamlab/modules/crm.rb', line 20

def get_result_of_convertation(options = {})
  @request.get(%w(settings currency convert), options)
end

#get_root_folder_idObject

region Files



577
578
579
# File 'lib/teamlab/modules/crm.rb', line 577

def get_root_folder_id
  @request.get(%w(files root))
end

#get_settingsObject



137
138
139
# File 'lib/teamlab/modules/crm.rb', line 137

def get_settings
  @request.get(%w(invoice settings))
end

#get_simple_contacts(options = {}) ⇒ Object



149
150
151
# File 'lib/teamlab/modules/crm.rb', line 149

def get_simple_contacts(options = {})
  @request.get(%w(contact simple filter), options)
end

#get_summary_table(currency) ⇒ Object



36
37
38
# File 'lib/teamlab/modules/crm.rb', line 36

def get_summary_table(currency)
  @request.get(['settings', 'currency', currency.to_s, 'summarytable'])
end

#get_tags_for_entity_type(entity_type) ⇒ Object



601
602
603
# File 'lib/teamlab/modules/crm.rb', line 601

def get_tags_for_entity_type(entity_type)
  @request.get([entity_type.to_s, 'tag'])
end

#get_task_by_id(task_id) ⇒ Object



399
400
401
# File 'lib/teamlab/modules/crm.rb', line 399

def get_task_by_id(task_id)
  @request.get(['task', task_id.to_s])
end

#get_task_category(category_id) ⇒ Object



403
404
405
# File 'lib/teamlab/modules/crm.rb', line 403

def get_task_category(category_id)
  @request.get(['task', 'category', category_id.to_s])
end

#get_task_list_by_filter(options = {}) ⇒ Object



391
392
393
# File 'lib/teamlab/modules/crm.rb', line 391

def get_task_list_by_filter(options = {})
  @request.get(%w(task filter), options)
end

#get_task_template(id) ⇒ Object



659
660
661
# File 'lib/teamlab/modules/crm.rb', line 659

def get_task_template(id)
  @request.get(['tasktemplatecontainer', 'tasktemplate', id.to_s])
end

#get_task_template_container(id) ⇒ Object



655
656
657
# File 'lib/teamlab/modules/crm.rb', line 655

def get_task_template_container(id)
  @request.get(['tasktemplatecontainer', id.to_s])
end

#get_task_template_container_list(entity_type) ⇒ Object



651
652
653
# File 'lib/teamlab/modules/crm.rb', line 651

def get_task_template_container_list(entity_type)
  @request.get([entity_type.to_s, 'tasktemplatecontainer'])
end

#get_task_template_list_by_container_id(id) ⇒ Object



663
664
665
# File 'lib/teamlab/modules/crm.rb', line 663

def get_task_template_list_by_container_id(id)
  @request.get(['tasktemplatecontainer', id.to_s, 'tasktemplate'])
end

#get_user_field_list(entity_type) ⇒ Object



759
760
761
# File 'lib/teamlab/modules/crm.rb', line 759

def get_user_field_list(entity_type)
  @request.get([entity_type.to_s, 'customfield', 'definitions'])
end

#get_user_field_values(entity_type, entity_id) ⇒ Object



755
756
757
# File 'lib/teamlab/modules/crm.rb', line 755

def get_user_field_values(entity_type, entity_id)
  @request.get([entity_type.to_s, entity_id.to_s, 'customfield'])
end

#group_contact_info(*items) ⇒ Object



479
480
481
# File 'lib/teamlab/modules/crm.rb', line 479

def group_contact_info(*items)
  @request.post(%w(contact data), items: items.flatten)
end

#group_contact_info_update(*items) ⇒ Object



515
516
517
# File 'lib/teamlab/modules/crm.rb', line 515

def group_contact_info_update(*items)
  @request.put(%w(contact data), items: items.flatten)
end


495
496
497
# File 'lib/teamlab/modules/crm.rb', line 495

def link_contact_list_with_project(project_id, *contact_ids)
  @request.post(['contact', 'project', project_id.to_s], contactId: contact_ids.flatten)
end


503
504
505
# File 'lib/teamlab/modules/crm.rb', line 503

def link_contact_with_project(contact_id, project_id)
  @request.post(['contact', contact_id.to_s, 'project', project_id.to_s])
end

#merge_contacts(from_contact_id, to_contact_id) ⇒ Object



519
520
521
# File 'lib/teamlab/modules/crm.rb', line 519

def merge_contacts(from_contact_id, to_contact_id)
  @request.put(%w(contact merge), fromcontactid: from_contact_id, tocontactid: to_contact_id)
end

#quick_company_list_creation(*names) ⇒ Object



487
488
489
# File 'lib/teamlab/modules/crm.rb', line 487

def quick_company_list_creation(*names)
  @request.post(%w(contact company quick), companyName: names.flatten)
end

#quick_person_list_creation(data) ⇒ Object



483
484
485
# File 'lib/teamlab/modules/crm.rb', line 483

def quick_person_list_creation(data)
  @request.post(%w(contact person quick), data: data)
end

#remove_contact_from_project(contact_id, project_id) ⇒ Object



571
572
573
# File 'lib/teamlab/modules/crm.rb', line 571

def remove_contact_from_project(contact_id, project_id)
  @request.delete(['contact', contact_id.to_s, 'project', project_id.to_s])
end

#remove_tag(entity_type, entity_id, tag_name) ⇒ Object



647
648
649
# File 'lib/teamlab/modules/crm.rb', line 647

def remove_tag(entity_type, entity_id, tag_name)
  @request.delete([entity_type.to_s, entity_id.to_s, 'tag'], tagName: tag_name)
end

#resume_case(case_id) ⇒ Object



727
728
729
# File 'lib/teamlab/modules/crm.rb', line 727

def resume_case(case_id)
  @request.put(['case', case_id.to_s, 'reopen'])
end

#resume_task(task_id) ⇒ Object



423
424
425
# File 'lib/teamlab/modules/crm.rb', line 423

def resume_task(task_id)
  @request.put(['task', task_id.to_s, 'reopen'])
end

#save_number_settings(options = {}) ⇒ Object



257
258
259
# File 'lib/teamlab/modules/crm.rb', line 257

def save_number_settings(options = {})
  @request.put(%w(invoice settings name), options)
end

#save_smtp_settings(options = {}) ⇒ Object



219
220
221
# File 'lib/teamlab/modules/crm.rb', line 219

def save_smtp_settings(options = {})
  @request.put(%w(settings smtp), options)
end

#save_terms_settings(options = {}) ⇒ Object



277
278
279
# File 'lib/teamlab/modules/crm.rb', line 277

def save_terms_settings(options = {})
  @request.put(%w(invoice settings terms), options)
end

#set_access_to_batch_contact(options = {}) ⇒ Object



261
262
263
# File 'lib/teamlab/modules/crm.rb', line 261

def set_access_to_batch_contact(options = {})
  @request.put(%w(contact filter access), options)
end

#set_case_access_rights(case_ids, options = {}) ⇒ Object



715
716
717
# File 'lib/teamlab/modules/crm.rb', line 715

def set_case_access_rights(case_ids, options = {})
  @request.put(%w(case access), { caseId: case_ids }.merge(options))
end

#set_case_access_rights_by_filter(options = {}) ⇒ Object



723
724
725
# File 'lib/teamlab/modules/crm.rb', line 723

def set_case_access_rights_by_filter(options = {})
  @request.put(%w(case filter access), options)
end

#set_contact_access_rights(contact_id, options = {}) ⇒ Object



531
532
533
# File 'lib/teamlab/modules/crm.rb', line 531

def set_contact_access_rights(contact_id, options = {})
  @request.put(['contact', contact_id.to_s, 'access'], options)
end

#set_contacts_access_rights(contact_ids, options = {}) ⇒ Object



523
524
525
# File 'lib/teamlab/modules/crm.rb', line 523

def set_contacts_access_rights(contact_ids, options = {})
  @request.put(%w(contact access), { contactId: contact_ids }.merge(options))
end

#set_is_portal_configured(options = {}) ⇒ Object



215
216
217
# File 'lib/teamlab/modules/crm.rb', line 215

def set_is_portal_configured(options = {})
  @request.put(%w(settings), options)
end

#set_opportunity_access_rights(opportunity_ids, is_private, *users) ⇒ Object



52
53
54
# File 'lib/teamlab/modules/crm.rb', line 52

def set_opportunity_access_rights(opportunity_ids, is_private, *users)
  @request.put(%w(opportunity access), opportunityid: opportunity_ids.to_a.flatten, isPrivate: is_private, accessList: users.flatten)
end

#set_opportunity_access_rights_for_users(options = {}) ⇒ Object



64
65
66
# File 'lib/teamlab/modules/crm.rb', line 64

def set_opportunity_access_rights_for_users(options = {})
  @request.put(%w(opportunity filter access), options)
end

#set_rights_to_case(case_id, options = {}) ⇒ Object



735
736
737
# File 'lib/teamlab/modules/crm.rb', line 735

def set_rights_to_case(case_id, options = {})
  @request.put(['case', case_id.to_s, 'access'], options)
end

#set_rights_to_opportunity(opportunity_id, is_private, access_list) ⇒ Object



77
78
79
# File 'lib/teamlab/modules/crm.rb', line 77

def set_rights_to_opportunity(opportunity_id, is_private, access_list)
  @request.put(['opportunity', opportunity_id.to_s, 'access'], isPrivate: is_private, accessList: access_list)
end

#set_user_field_value(entity_type, entity_id, field_id, field_value) ⇒ Object



767
768
769
# File 'lib/teamlab/modules/crm.rb', line 767

def set_user_field_value(entity_type, entity_id, field_id, field_value)
  @request.post([entity_type.to_s, entity_id.to_s, 'customfield', field_id.to_s], fieldValue: field_value)
end

#update_case(case_id, title, options = {}) ⇒ Object



719
720
721
# File 'lib/teamlab/modules/crm.rb', line 719

def update_case(case_id, title, options = {})
  @request.put(['case', case_id.to_s], { title: title }.merge(options))
end

#update_company(company_id, company_name, options = {}) ⇒ Object



535
536
537
# File 'lib/teamlab/modules/crm.rb', line 535

def update_company(company_id, company_name, options = {})
  @request.put(['contact', 'company', company_id.to_s], { companyName: company_name.to_s }.merge(options))
end

#update_company_and_participants_status(company_id, contact_status_id) ⇒ Object



315
316
317
# File 'lib/teamlab/modules/crm.rb', line 315

def update_company_and_participants_status(company_id, contact_status_id)
  @request.put(['contact', 'company', company_id.to_s, 'status'], contactStatusId: contact_status_id)
end

#update_contact_address(contact_id, information_id, address, options = {}) ⇒ Object



547
548
549
# File 'lib/teamlab/modules/crm.rb', line 547

def update_contact_address(contact_id, information_id, address, options = {})
  @request.put(['contact', contact_id.to_s, 'data', 'address', information_id.to_s], { address: address }.merge(options))
end

#update_contact_info(information_id, contact_id, data, options = {}) ⇒ Object



539
540
541
# File 'lib/teamlab/modules/crm.rb', line 539

def update_contact_info(information_id, contact_id, data, options = {})
  @request.put(['contact', contact_id.to_s, 'data', information_id.to_s], { data: data }.merge(options))
end

#update_contact_status(id, title, options = {}) ⇒ Object



243
244
245
# File 'lib/teamlab/modules/crm.rb', line 243

def update_contact_status(id, title, options = {})
  @request.put(['contact', 'status', id.to_s], { title: title.to_s }.merge(options))
end

#update_contact_status_by_id(contact_id, contact_status_id) ⇒ Object



297
298
299
# File 'lib/teamlab/modules/crm.rb', line 297

def update_contact_status_by_id(contact_id, contact_status_id)
  @request.put(['contact', contact_id, 'status'], contactStatusid: contact_status_id)
end

#update_contact_status_color(status_id, color) ⇒ Object



289
290
291
# File 'lib/teamlab/modules/crm.rb', line 289

def update_contact_status_color(status_id, color)
  @request.put(['contact', 'status', status_id.to_s, 'color'], color: color)
end

#update_contact_type(id, title, options = {}) ⇒ Object



239
240
241
# File 'lib/teamlab/modules/crm.rb', line 239

def update_contact_type(id, title, options = {})
  @request.put(['contact', 'type', id.to_s], { title: title }.merge(options))
end

#update_contact_types_order(*titles) ⇒ Object



527
528
529
# File 'lib/teamlab/modules/crm.rb', line 527

def update_contact_types_order(*titles)
  @request.put(%w(contact type reorder), titles: titles.flatten)
end

#update_crm_contact_status_settings(options = {}) ⇒ Object



281
282
283
# File 'lib/teamlab/modules/crm.rb', line 281

def update_crm_contact_status_settings(options = {})
  @request.put(%w(contact status settings), options)
end

#update_crm_contact_tag_setting(options = {}) ⇒ Object



253
254
255
# File 'lib/teamlab/modules/crm.rb', line 253

def update_crm_contact_tag_setting(options = {})
  @request.put(%w(contact tag settings), options)
end

#update_crm_currency(currency) ⇒ Object



223
224
225
# File 'lib/teamlab/modules/crm.rb', line 223

def update_crm_currency(currency)
  @request.put(%w(settings currency), {currency: currency})
end

#update_history_categories_order(*titles) ⇒ Object



375
376
377
# File 'lib/teamlab/modules/crm.rb', line 375

def update_history_categories_order(*titles)
  @request.put(%w(history category reorder), titles: titles.flatten)
end

#update_history_category(id, title, options = {}) ⇒ Object



371
372
373
# File 'lib/teamlab/modules/crm.rb', line 371

def update_history_category(id, title, options = {})
  @request.put(['history', 'category', id.to_s], { title: title }.merge(options))
end

#update_history_category_icon(id, icon_name) ⇒ Object



379
380
381
# File 'lib/teamlab/modules/crm.rb', line 379

def update_history_category_icon(id, icon_name)
  @request.put(['history', 'category', id.to_s, 'icon'], imageName: icon_name.to_s)
end

#update_invoice(id, options = {}) ⇒ Object

TODO: OPTIONAL VARIABLES =====================================================


249
250
251
# File 'lib/teamlab/modules/crm.rb', line 249

def update_invoice(id, options = {})
  @request.put(['invoice', id.to_s], options)
end

#update_invoice_item(id, title, description, price, stock_keeping_unit, options = {}) ⇒ Object



231
232
233
# File 'lib/teamlab/modules/crm.rb', line 231

def update_invoice_item(id, title, description, price, stock_keeping_unit, options = {})
  @request.put(['invoiceitem', id.to_s], { title: title, description: description, price: price, sku: stock_keeping_unit.to_s }.merge(options))
end

#update_invoice_line(invoice_line_id, invoice_id, options = {}) ⇒ Object



301
302
303
# File 'lib/teamlab/modules/crm.rb', line 301

def update_invoice_line(invoice_line_id, invoice_id, options = {})
  @request.put(['invoiceline', invoice_line_id], { invoiceId: invoice_id }.merge(options))
end

#update_invoice_patch_status(status, invoice_ids) ⇒ Object



285
286
287
# File 'lib/teamlab/modules/crm.rb', line 285

def update_invoice_patch_status(status, invoice_ids)
  @request.put(['invoice', 'status', status.to_s], invoiceids: invoice_ids)
end

#update_invoice_tax(id, name, options = {}) ⇒ Object



235
236
237
# File 'lib/teamlab/modules/crm.rb', line 235

def update_invoice_tax(id, name, options = {})
  @request.put(['invoice', 'tax', id.to_s], { name: name }.merge(options))
end

#update_opportunity(opportunity_id, contact_id, title, responsible_id, stage_id, options = {}) ⇒ Object



68
69
70
71
# File 'lib/teamlab/modules/crm.rb', line 68

def update_opportunity(opportunity_id, contact_id, title, responsible_id, stage_id, options = {})
  @request.put(['opportunity', opportunity_id.to_s], { contactId: contact_id, title: title, responsibleid: responsible_id,
                                                       stageid: stage_id }.merge(options))
end

#update_opportunity_stage(id, title, color, options = {}) ⇒ Object



56
57
58
# File 'lib/teamlab/modules/crm.rb', line 56

def update_opportunity_stage(id, title, color, options = {})
  @request.put(['opportunity', 'stage', id.to_s], { title: title, color: color }.merge(options))
end

#update_opportunity_stage_color(stage_id, color) ⇒ Object



73
74
75
# File 'lib/teamlab/modules/crm.rb', line 73

def update_opportunity_stage_color(stage_id, color)
  @request.put(['opportunity', 'stage', stage_id.to_s, 'color'], color: color)
end

#update_opportunity_stages_order(options = {}) ⇒ Object



60
61
62
# File 'lib/teamlab/modules/crm.rb', line 60

def update_opportunity_stages_order(options = {})
  @request.put(%w(opportunity stage reorder), options)
end

#update_opportunity_to_stage(opportunity_id, stage_id) ⇒ Object



81
82
83
# File 'lib/teamlab/modules/crm.rb', line 81

def update_opportunity_to_stage(opportunity_id, stage_id)
  @request.put(['opportunity', opportunity_id.to_s, 'stage', stage_id.to_s], stageid: stage_id)
end

#update_organisation_address(text) ⇒ Object



269
270
271
# File 'lib/teamlab/modules/crm.rb', line 269

def update_organisation_address(text)
  @request.put(%w(settings organisation address), {companyAddress: text})
end

#update_organisation_company_name(title) ⇒ Object



265
266
267
# File 'lib/teamlab/modules/crm.rb', line 265

def update_organisation_company_name(title)
  @request.put(%w(settings organisation base), {companyName: title})
end

#update_person(id, first_name, last_name, options = {}) ⇒ Object



293
294
295
# File 'lib/teamlab/modules/crm.rb', line 293

def update_person(id, first_name, last_name, options = {})
  @request.put(['contact', 'person', id.to_s], { firstName: first_name, lastName: last_name }.merge(options))
end

#update_person_and_its_company_status(person_id, contact_status_id) ⇒ Object



311
312
313
# File 'lib/teamlab/modules/crm.rb', line 311

def update_person_and_its_company_status(person_id, contact_status_id)
  @request.put(['contact', 'person', person_id.to_s, 'status'], contactStatusId: contact_status_id)
end

#update_selected_user_field(entity_type, user_field_id, label, field_type, options = {}) ⇒ Object



771
772
773
# File 'lib/teamlab/modules/crm.rb', line 771

def update_selected_user_field(entity_type, user_field_id, label, field_type, options = {})
  @request.put([entity_type.to_s, 'customfield', user_field_id.to_s], { fieldType: field_type, label: label }.merge(options))
end

#update_statuses_contact_order(options = {}) ⇒ Object



273
274
275
# File 'lib/teamlab/modules/crm.rb', line 273

def update_statuses_contact_order(options = {})
  @request.put(%w(contact status reorder), options)
end

#update_task(task_id, title, deadline, category_id, options = {}) ⇒ Object



227
228
229
# File 'lib/teamlab/modules/crm.rb', line 227

def update_task(task_id, title, deadline, category_id, options = {})
  @request.put(['task', task_id.to_s], { title: title, deadline: deadline, categoryid: category_id }.merge(options))
end

#update_task_categories_order(*titles) ⇒ Object



427
428
429
# File 'lib/teamlab/modules/crm.rb', line 427

def update_task_categories_order(*titles)
  @request.put(%w(task category reorder), titles: titles.flatten)
end

#update_task_category(category_id, title, options = {}) ⇒ Object



415
416
417
# File 'lib/teamlab/modules/crm.rb', line 415

def update_task_category(category_id, title, options = {})
  @request.put(['task', 'category', category_id.to_s], { title: title }.merge(options))
end

#update_task_category_icon(id, image_name) ⇒ Object



431
432
433
# File 'lib/teamlab/modules/crm.rb', line 431

def update_task_category_icon(id, image_name)
  @request.put(['task', 'category', id.to_s, 'icon'], imageName: image_name.to_s)
end

#update_task_template(container_id, task_template_id, title, options = {}) ⇒ Object

TODO: OPTIONAL VARIABLES =====================================================


683
684
685
# File 'lib/teamlab/modules/crm.rb', line 683

def update_task_template(container_id, task_template_id, title, options = {})
  @request.put(['tasktemplatecontainer', container_id.to_s, 'tasktemplate'], { id: task_template_id.to_s, title: title }.merge(options))
end

#update_task_template_container(container_id, title) ⇒ Object



677
678
679
# File 'lib/teamlab/modules/crm.rb', line 677

def update_task_template_container(container_id, title)
  @request.put(['tasktemplatecontainer', container_id.to_s], title: title)
end

#update_user_fields_order(entity_type, *field_ids) ⇒ Object



775
776
777
# File 'lib/teamlab/modules/crm.rb', line 775

def update_user_fields_order(entity_type, *field_ids)
  @request.put([entity_type.to_s, 'customfield', 'reorder'], fieldIds: field_ids.flatten)
end

#upload_file(entity_type, entity_id, file) ⇒ Object



593
594
595
# File 'lib/teamlab/modules/crm.rb', line 593

def upload_file(entity_type, entity_id, file)
  @request.post([entity_type.to_s, entity_id.to_s, 'files', 'upload'], somefile: File.new(file))
end