Module: Mrkt::CrudLists

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

Instance Method Summary collapse

Instance Method Details

#add_leads_to_list(list_id, lead_ids) ⇒ Object


13
14
15
16
17
# File 'lib/mrkt/concerns/crud_lists.rb', line 13

def add_leads_to_list(list_id, lead_ids)
  post_json("/rest/v1/lists/#{list_id}/leads.json") do
    { input: map_lead_ids(lead_ids) }
  end
end

#get_leads_by_list(list_id, fields: nil, batch_size: nil, next_page_token: nil) ⇒ Object


3
4
5
6
7
8
9
10
11
# File 'lib/mrkt/concerns/crud_lists.rb', line 3

def get_leads_by_list(list_id, fields: nil, batch_size: nil, next_page_token: nil)
  optional = {
    fields: fields,
    batchSize: batch_size,
    nextPageToken: next_page_token
  }

  get("/rest/v1/list/#{list_id}/leads.json", {}, optional)
end

#remove_leads_from_list(list_id, lead_ids) ⇒ Object


19
20
21
22
23
# File 'lib/mrkt/concerns/crud_lists.rb', line 19

def remove_leads_from_list(list_id, lead_ids)
  delete("/rest/v1/lists/#{list_id}/leads.json") do |req|
    json_payload(req, input: map_lead_ids(lead_ids))
  end
end