Module: Teamlab::CrmUserFields

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

Overview

Methods for working with crm tasks

Instance Method Summary collapse

Instance Method Details

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



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

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_user_field(entity_type, field_id) ⇒ Object



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

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

#get_user_field_list(entity_type) ⇒ Object



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

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



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

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

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



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

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_selected_user_field(entity_type, user_field_id, label, field_type, options = {}) ⇒ Object



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

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_user_fields_order(entity_type, *field_ids) ⇒ Object



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

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