module Teamlab::CrmContacts

Methods for working with crm contacts methods

Public Instance Methods

add_contact_info(contact_id, infotype, data, category, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 154
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_opportunity(contact_id, opportunity_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 170
def add_contact_opportunity(contact_id, opportunity_id)
  @request.post(['contact', contact_id.to_s, 'opportunity', opportunity_id.to_s])
end
add_persons_to_company(company_id, person_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 162
def add_persons_to_company(company_id, person_id)
  @request.post(['contact', 'company', company_id.to_s, 'person'], personId: person_id)
end
add_tag_to_batch_contacts(tags, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 46
def add_tag_to_batch_contacts(tags, options = {})
  @request.post(%w[contact filter taglist], { tags: tags }.merge(options))
end
change_contact_photo(contact_id, photo) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 86
def change_contact_photo(contact_id, photo)
  @request.put(['contact', contact_id.to_s, 'changephoto'], photo: File.new(photo))
end
change_contact_photo_by_url(contact_id, photo_url) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 219
def change_contact_photo_by_url(contact_id, photo_url)
  @request.put(['contact', contact_id.to_s, 'changephotobyurl'], photourl: photo_url)
end
create_company(company_name, managers, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 38
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 = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 30
def create_contact_status(title, color, options = {})
  @request.post(%w[contact status], { title: title, color: color }.merge(options))
end
create_contact_type(title, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 26
def create_contact_type(title, options = {})
  @request.post(%w[contact type], { title: title }.merge(options))
end
create_person(first_name, last_name, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 34
def create_person(first_name, last_name, options = {})
  @request.post(%w[contact person], { firstName: first_name, lastName: last_name }.merge(options))
end
create_task_group(title, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 42
def create_task_group(title, options = {})
  @request.post(%w[contact task group], { title: title }.merge(options))
end
delete_batch_contacts_by_filter(options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 98
def delete_batch_contacts_by_filter(options = {})
  @request.delete(%w[contact filter], options)
end
delete_contact(id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 223
def delete_contact(id)
  @request.delete(['contact', id.to_s])
end
delete_contact_group(*contact_ids) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 174
def delete_contact_group(*contact_ids)
  @request.put(%w[contact], contactids: contact_ids.flatten)
end
Also aliased as: delete_contacts_bulk
delete_contact_info(contact_id, info_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 231
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) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 102
def delete_contact_status(contact_status_id)
  @request.delete(['contact', 'status', contact_status_id])
end
delete_contact_type(contact_type_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 227
def delete_contact_type(contact_type_id)
  @request.delete(['contact', 'type', contact_type_id.to_s])
end
delete_contacts_bulk(*contact_ids)
delete_deal_from_contact(contact_id, opportunity_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 106
def delete_deal_from_contact(contact_id, opportunity_id)
  @request.delete(['contact', contact_id.to_s, 'opportunity', opportunity_id.to_s])
end
delete_person_from_company(company_id, person_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 235
def delete_person_from_company(company_id, person_id)
  @request.delete(['contact', 'company', company_id.to_s, 'person'], personId: person_id)
end
get_all_categories(info_type) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 134
def get_all_categories(info_type)
  @request.get(['contact', 'data', info_type.to_s, 'category'])
end
get_all_contact_info_types() click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 118
def get_all_contact_info_types
  @request.get(%w[contact data infotype])
end
get_all_contact_types() click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 110
def get_all_contact_types
  @request.get(%w[contact type])
end
get_company_linked_persons_list(company_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 138
def get_company_linked_persons_list(company_id)
  @request.get(['contact', 'company', company_id.to_s, 'person'])
end
get_contact_by_id(id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 114
def get_contact_by_id(id)
  @request.get(['contact', id.to_s])
end
get_contact_info(contact_id, contact_info_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 130
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) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 142
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) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 22
def get_contact_status_by_id(contact_status_id)
  @request.get(['contact', 'status', contact_status_id.to_s])
end
get_contact_statuses() click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 10
def get_contact_statuses
  @request.get(%w[contact status])
end
get_contact_type(id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 126
def get_contact_type(id)
  @request.get(['contact', 'type', id.to_s])
end
get_contacts_by_filter(options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 14
def get_contacts_by_filter(options = {})
  @request.get(%w[contact filter], options)
end
get_contacts_by_project_id(id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 122
def get_contacts_by_project_id(id)
  @request.get(['contact', 'project', id.to_s])
end
get_contacts_for_mail(*contact_ids) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 6
def get_contacts_for_mail(*contact_ids)
  @request.get(%w[contact mail], contactids: contact_ids.flatten)
end
get_simple_contacts(options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 18
def get_simple_contacts(options = {})
  @request.get(%w[contact simple filter], options)
end
merge_contacts(from_contact_id, to_contact_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 179
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) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 150
def quick_company_list_creation(*names)
  @request.post(%w[contact company quick], companyName: names.flatten)
end
quick_person_list_creation(data) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 146
def quick_person_list_creation(data)
  @request.post(%w[contact person quick], data: data)
end
remove_contact_from_project(contact_id, project_id) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 239
def remove_contact_from_project(contact_id, project_id)
  @request.delete(['contact', contact_id.to_s, 'project', project_id.to_s])
end
set_access_to_batch_contact(options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 62
def set_access_to_batch_contact(options = {})
  @request.put(%w[contact filter access], options)
end
set_contact_access_rights(contact_id, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 191
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 = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 183
def set_contacts_access_rights(contact_ids, options = {})
  @request.put(%w[contact access], { contactId: contact_ids }.merge(options))
end
update_company(company_id, company_name, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 195
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) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 94
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_info(information_id, contact_id, data, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 215
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 = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 54
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) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 82
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) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 74
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 = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 50
def update_contact_type(id, title, options = {})
  @request.put(['contact', 'type', id.to_s], { title: title }.merge(options))
end
update_contact_types_order(*titles) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 187
def update_contact_types_order(*titles)
  @request.put(%w[contact type reorder], titles: titles.flatten)
end
update_crm_contact_status_settings(options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 70
def update_crm_contact_status_settings(options = {})
  @request.put(%w[contact status settings], options)
end
update_crm_contact_tag_setting(options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 58
def update_crm_contact_tag_setting(options = {})
  @request.put(%w[contact tag settings], options)
end
update_crm_entity_creation_date(entity_name, entity_id, date = '2007-01-01') click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 199
def update_crm_entity_creation_date(entity_name, entity_id, date = '2007-01-01')
  id_field = "#{entity_name}id".to_sym
  options = {}
  options[id_field] = entity_id.to_s
  options[:creationDate] = date.to_s
  @request.put([entity_name.to_s, entity_id.to_s, 'creationdate'], options)
end
update_crm_entity_modification_date(entity_name, entity_id, date = '2007-01-01') click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 207
def update_crm_entity_modification_date(entity_name, entity_id, date = '2007-01-01')
  id_field = "#{entity_name}id".to_sym
  options = {}
  options[id_field] = entity_id.to_s
  options[:lastModifedDate] = date.to_s
  @request.put([entity_name.to_s, entity_id.to_s, 'lastmodifeddate'], options)
end
update_person(id, first_name, last_name, options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 78
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) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 90
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_statuses_contact_order(options = {}) click to toggle source
# File lib/teamlab/modules/crm/crm_contacts.rb, line 66
def update_statuses_contact_order(options = {})
  @request.put(%w[contact status reorder], options)
end