lib/mrkt/concerns/crud_leads.rb in mrkt-0.7.0 vs lib/mrkt/concerns/crud_leads.rb in mrkt-0.8.0

- old
+ new

@@ -38,7 +38,18 @@ post("/rest/v1/leads/#{id}/associate.json?#{params.to_query}") do |req| json_payload(req, {}) end end + + def merge_leads(winning_lead_id, losing_lead_ids, merge_in_crm: false) + params = Faraday::Utils::ParamsHash.new + params[:mergeInCRM] = merge_in_crm + params[:leadIds] = losing_lead_ids.join(',') if losing_lead_ids + + post("/rest/v1/leads/#{winning_lead_id}/merge.json?#{params.to_query}") do |req| + json_payload(req,{}) + end + end + end end