Module: Teamlab::CrmTags

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

Overview

Methods for working with crm cases

Instance Method Summary collapse

Instance Method Details

#add_contact_tag_to_group(entity_type, entity_id, tag) ⇒ Object



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

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_tag(entity_type, entity_id, tag_name) ⇒ Object



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

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



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

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_case_group_by_filter(tag_name, options = {}) ⇒ Object



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

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



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

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

#create_tag(entity_type, tag_name) ⇒ Object



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

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

#delete_contact_tag_of_group(entity_type, entity_id, tag) ⇒ String

Deletes the selected tag from the entity (company or person) specified in the request and from all the related contacts

Parameters:

  • entity_type (String, Symbol)

    Entity type

  • entity_id (String)

    Entity ID

  • tag (String)

    Tag name

Returns:

  • (String)

    Tag name



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

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

#delete_tag(entity_type, tag_name) ⇒ Object



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

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

#delete_unused_tags(entity_type) ⇒ Object



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

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

#get_all_contact_tags(contact_id) ⇒ Object



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

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

#get_entity_tags(entity_type, entity_id) ⇒ Object



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

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

#get_tags_for_entity_type(entity_type) ⇒ Object



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

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

#remove_tag(entity_type, entity_id, tag_name) ⇒ Object



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

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