Module: Teamlab::CrmOpportunities
- Included in:
- Crm
- Defined in:
- lib/teamlab/modules/crm/crm_opportunities.rb
Overview
Methods for working with crm opportunities methods
Instance Method Summary collapse
- #add_opportunity_contact(opportunity_id, contact_id) ⇒ Object
- #create_opportunity(stage_id, title, responsible_id, options = {}) ⇒ Object
- #create_opportunity_stage(title, color, options = {}) ⇒ Object
- #delete_opportunity(opportunity_id) ⇒ Object
- #delete_opportunity_contact(opportunity_id, contact_id) ⇒ Object
- #delete_opportunity_group(*opportunity_ids) ⇒ Object (also: #delete_opportunities_bulk)
- #delete_opportunity_group_by_filter(options = {}) ⇒ Object
- #delete_opportunity_stage(stage_id) ⇒ Object
- #get_all_opportunity_contacts(opportunity_id) ⇒ Object
- #get_all_opportunity_stages ⇒ Object
-
#get_contact_opportunities(contact_id) ⇒ Array
Returns a list of all the opportunities for the contact with the ID specified in the request.
- #get_opportunity_by_id(id) ⇒ Object
- #get_opportunity_list(options = {}) ⇒ Object
- #get_opportunity_stage(stage_id) ⇒ Object
- #set_opportunity_access_rights(opportunity_ids, is_private, *users) ⇒ Object
- #set_opportunity_access_rights_for_users(options = {}) ⇒ Object
- #set_rights_to_opportunity(opportunity_id, is_private, access_list) ⇒ Object
- #update_opportunity(opportunity_id, contact_id, title, responsible_id, stage_id, options = {}) ⇒ Object
- #update_opportunity_stage(id, title, color, options = {}) ⇒ Object
- #update_opportunity_stage_color(stage_id, color) ⇒ Object
- #update_opportunity_stages_order(options = {}) ⇒ Object
- #update_opportunity_to_stage(opportunity_id, stage_id) ⇒ Object
Instance Method Details
#add_opportunity_contact(opportunity_id, contact_id) ⇒ Object
42 43 44 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 42 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 = {}) ⇒ Object
33 34 35 36 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 33 def create_opportunity(stage_id, title, responsible_id, = {}) [:bidCurrencyAbbr] ||= 'USD' @request.post(%w[opportunity], { stageId: stage_id, title: title, responsibleid: responsible_id }.merge()) end |
#create_opportunity_stage(title, color, options = {}) ⇒ Object
38 39 40 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 38 def create_opportunity_stage(title, color, = {}) @request.post(%w[opportunity stage], { title: title, color: color }.merge()) end |
#delete_opportunity(opportunity_id) ⇒ Object
92 93 94 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 92 def delete_opportunity(opportunity_id) @request.delete(['opportunity', opportunity_id.to_s]) end |
#delete_opportunity_contact(opportunity_id, contact_id) ⇒ Object
96 97 98 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 96 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) ⇒ Object Also known as: delete_opportunities_bulk
79 80 81 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 79 def delete_opportunity_group(*opportunity_ids) @request.put(%w[opportunity], opportunityids: opportunity_ids.flatten) end |
#delete_opportunity_group_by_filter(options = {}) ⇒ Object
84 85 86 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 84 def delete_opportunity_group_by_filter( = {}) @request.delete(%w[opportunity filter], ) end |
#delete_opportunity_stage(stage_id) ⇒ Object
88 89 90 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 88 def delete_opportunity_stage(stage_id) @request.delete(['opportunity', 'stage', stage_id.to_s]) end |
#get_all_opportunity_contacts(opportunity_id) ⇒ Object
22 23 24 |
# 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 ⇒ Object
6 7 8 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 6 def get_all_opportunity_stages @request.get(%w[opportunity stage]) end |
#get_contact_opportunities(contact_id) ⇒ Array
Returns a list of all the opportunities for the contact with the ID specified in the request
29 30 31 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 29 def get_contact_opportunities(contact_id) @request.get(['opportunity', 'bycontact', contact_id.to_s]) end |
#get_opportunity_by_id(id) ⇒ Object
18 19 20 |
# 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 = {}) ⇒ Object
10 11 12 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 10 def get_opportunity_list( = {}) @request.get(%w[opportunity filter], ) end |
#get_opportunity_stage(stage_id) ⇒ Object
14 15 16 |
# 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) ⇒ Object
46 47 48 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 46 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 = {}) ⇒ Object
58 59 60 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 58 def set_opportunity_access_rights_for_users( = {}) @request.put(%w[opportunity filter access], ) end |
#set_rights_to_opportunity(opportunity_id, is_private, access_list) ⇒ Object
71 72 73 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 71 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 = {}) ⇒ Object
62 63 64 65 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 62 def update_opportunity(opportunity_id, contact_id, title, responsible_id, stage_id, = {}) @request.put(['opportunity', opportunity_id.to_s], { contactId: contact_id, title: title, responsibleid: responsible_id, stageid: stage_id }.merge()) end |
#update_opportunity_stage(id, title, color, options = {}) ⇒ Object
50 51 52 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 50 def update_opportunity_stage(id, title, color, = {}) @request.put(['opportunity', 'stage', id.to_s], { title: title, color: color }.merge()) end |
#update_opportunity_stage_color(stage_id, color) ⇒ Object
67 68 69 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 67 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 = {}) ⇒ Object
54 55 56 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 54 def update_opportunity_stages_order( = {}) @request.put(%w[opportunity stage reorder], ) end |
#update_opportunity_to_stage(opportunity_id, stage_id) ⇒ Object
75 76 77 |
# File 'lib/teamlab/modules/crm/crm_opportunities.rb', line 75 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 |