class Emarsys::ContactList

Methods for the ContactList API

Public Class Methods

add_contacts(id, key_id:, external_ids: [], account: nil) click to toggle source

Add a contacts to a specific contact list

This cannot be an instance method, because the API does not allow to retrieve a single resource. How crappy is that?

# File lib/emarsys/data_objects/contact_list.rb, line 53
def add_contacts(id, key_id:, external_ids: [], account: nil)
  post account, "contactlist/#{id}/add", {'key_id' => key_id, 'external_ids' => external_ids}
end
collection(account: nil) click to toggle source

List contact lists

@return [Hash] List of contact_lists @example

Emarsys::ContactList.collection
# File lib/emarsys/data_objects/contact_list.rb, line 15
def collection(account: nil)
  get account, 'contactlist', {}
end
contacts(id, account: nil) click to toggle source

List contacts in a contact list Reference: dev.emarsys.com/v2/contact-lists/list-contacts-in-a-contact-list

@param id [Integer] The contact list id

# File lib/emarsys/data_objects/contact_list.rb, line 23
def contacts(id, account: nil)
  get account, "contactlist/#{id}/", {}
end
create(account: nil, **params) click to toggle source

@return [Hash] internal id of the contact list @example

Emarsys::ContactList.create(key_id: "3", name: 'Test-Liste', description: 'Something')
# File lib/emarsys/data_objects/contact_list.rb, line 36
def create(account: nil, **params)
  post account, "contactlist", params
end
delete(id, account: nil) click to toggle source

@example

Emarsys::ContactList.delete(751283429)
# File lib/emarsys/data_objects/contact_list.rb, line 46
def delete(id, account: nil)
  post account, "contactlist/#{id}/deletelist", {}
end
remove_contacts(id, key_id:, external_ids: [], account: nil) click to toggle source

Remove contacts from a specific contact list

This cannot be an instance method, because the API does not allow to retrieve a single resource. How crappy is that?

# File lib/emarsys/data_objects/contact_list.rb, line 60
def remove_contacts(id, key_id:, external_ids: [], account: nil)
  post account, "contactlist/#{id}/delete", {'key_id' => key_id, 'external_ids' => external_ids}
end