Module: Teamlab::CrmCases

Included in:
Crm
Defined in:
lib/teamlab/modules/crm/crm_cases.rb

Overview

Methods for working with crm cases

Instance Method Summary collapse

Instance Method Details

#add_case_contact(case_id, contact_id) ⇒ Object



26
27
28
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 26

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

#close_case(case_id) ⇒ Object



46
47
48
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 46

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

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



22
23
24
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 22

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

#delete_case(case_id) ⇒ Object



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

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

#delete_case_contact(case_id, contact_id) ⇒ Object



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

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 Also known as: delete_cases_bulk



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

def delete_case_group(*case_ids)
  @request.put(%w[case], casesids: case_ids.flatten)
end

#delete_case_group_by_filter(options = {}) ⇒ Object



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

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

#get_all_case_contacts(case_id) ⇒ Object



18
19
20
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 18

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

#get_case_by_id(id) ⇒ Object



14
15
16
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 14

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

#get_case_list(options = {}) ⇒ Object



10
11
12
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 10

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

#get_cases_by_prefix(contact_id, prefix) ⇒ Object



6
7
8
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 6

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

#resume_case(case_id) ⇒ Object



42
43
44
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 42

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

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



30
31
32
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 30

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



38
39
40
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 38

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

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



50
51
52
53
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 50

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

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



34
35
36
# File 'lib/teamlab/modules/crm/crm_cases.rb', line 34

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