module Teamlab::CrmOpportunities
Methods for working with crm opportunities methods
Public Instance Methods
add_opportunity_contact(opportunity_id, contact_id)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 35 def add_opportunity_contact(opportunity_id, contact_id) @request.post(['opportunity', opportunity_id.to_s, 'contact', contact_id.to_s]) end
create_opportunity(stage_id, title, responsible_id, options = {})
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 26 def create_opportunity(stage_id, title, responsible_id, options = {}) options[:bidCurrencyAbbr] ||= 'USD' @request.post(%w[opportunity], { stageId: stage_id, title: title, responsibleid: responsible_id }.merge(options)) end
create_opportunity_stage(title, color, options = {})
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 31 def create_opportunity_stage(title, color, options = {}) @request.post(%w[opportunity stage], { title: title, color: color }.merge(options)) end
delete_opportunity(opportunity_id)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 85 def delete_opportunity(opportunity_id) @request.delete(['opportunity', opportunity_id.to_s]) end
delete_opportunity_contact(opportunity_id, contact_id)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 89 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)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 72 def delete_opportunity_group(*opportunity_ids) @request.put(%w[opportunity], opportunityids: opportunity_ids.flatten) end
Also aliased as: delete_opportunities_bulk
delete_opportunity_group_by_filter(options = {})
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 77 def delete_opportunity_group_by_filter(options = {}) @request.delete(%w[opportunity filter], options) end
delete_opportunity_stage(stage_id)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 81 def delete_opportunity_stage(stage_id) @request.delete(['opportunity', 'stage', stage_id.to_s]) end
get_all_opportunity_contacts(opportunity_id)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 22 def get_all_opportunity_contacts(opportunity_id) @request.get(['opportunity', opportunity_id.to_s, 'contact']) end
get_all_opportunity_stages()
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 6 def get_all_opportunity_stages @request.get(%w[opportunity stage]) end
get_opportunity_by_id(id)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 18 def get_opportunity_by_id(id) @request.get(['opportunity', id.to_s]) end
get_opportunity_list(options = {})
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 10 def get_opportunity_list(options = {}) @request.get(%w[opportunity filter], options) end
get_opportunity_stage(stage_id)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 14 def get_opportunity_stage(stage_id) @request.get(['opportunity', 'stage', stage_id.to_s]) end
set_opportunity_access_rights(opportunity_ids, is_private, *users)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 39 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 = {})
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 51 def set_opportunity_access_rights_for_users(options = {}) @request.put(%w[opportunity filter access], options) end
set_rights_to_opportunity(opportunity_id, is_private, access_list)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 64 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
update_opportunity(opportunity_id, contact_id, title, responsible_id, stage_id, options = {})
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 55 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 = {})
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 43 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)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 60 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 = {})
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 47 def update_opportunity_stages_order(options = {}) @request.put(%w[opportunity stage reorder], options) end
update_opportunity_to_stage(opportunity_id, stage_id)
click to toggle source
# File lib/teamlab/modules/crm/crm_opportunities.rb, line 68 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