lib/mrkt/concerns/crud_leads.rb in mrkt-0.6.0 vs lib/mrkt/concerns/crud_leads.rb in mrkt-0.6.1
- old
+ new
@@ -10,31 +10,27 @@
params[:nextPageToken] = next_page_token if next_page_token
get('/rest/v1/leads.json', params)
end
- def createupdate_leads(leads, action: 'createOrUpdate', lookup_field: nil, partition_name: nil)
+ def createupdate_leads(leads, action: 'createOrUpdate', lookup_field: nil, partition_name: nil, async_processing: nil)
post('/rest/v1/leads.json') do |req|
params = {
action: action,
input: leads
}
params[:lookupField] = lookup_field if lookup_field
params[:partitionName] = partition_name if partition_name
+ params[:asyncProcessing] = async_processing if async_processing
json_payload(req, params)
end
end
def delete_leads(leads)
delete('/rest/v1/leads.json') do |req|
- json_payload(req, input: leads.map { |lead_id| { id: lead_id } })
+ json_payload(req, input: map_lead_ids(leads))
end
- end
-
- def json_payload(req, payload)
- req.headers[:content_type] = 'application/json'
- req.body = JSON.generate(payload)
end
def associate_lead(id, cookie)
params = Faraday::Utils::ParamsHash.new
params[:cookie] = cookie