Module: Mrkt::ImportLeads

Included in:
Client
Defined in:
lib/mrkt/concerns/import_leads.rb

Instance Method Summary collapse

Instance Method Details

#import_lead(file, format = 'csv', lookup_field: nil, list_id: nil, partition_name: nil) ⇒ Object


3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mrkt/concerns/import_leads.rb', line 3

def import_lead(file, format = 'csv', lookup_field: nil, list_id: nil, partition_name: nil)
  params = {
    format: format,
    file: ::Faraday::UploadIO.new(file, 'text/csv')
  }

  optional = {
    lookupField: lookup_field,
    listId: list_id,
    partitionName: partition_name
  }

  post('/bulk/v1/leads.json', params, optional)
end

#import_lead_failures(id) ⇒ Object


22
23
24
# File 'lib/mrkt/concerns/import_leads.rb', line 22

def import_lead_failures(id)
  get("/bulk/v1/leads/batch/#{id}/failures.json")
end

#import_lead_status(id) ⇒ Object


18
19
20
# File 'lib/mrkt/concerns/import_leads.rb', line 18

def import_lead_status(id)
  get("/bulk/v1/leads/batch/#{id}.json")
end

#import_lead_warnings(id) ⇒ Object


26
27
28
# File 'lib/mrkt/concerns/import_leads.rb', line 26

def import_lead_warnings(id)
  get("/bulk/v1/leads/batch/#{id}/warnings.json")
end