Class: Emarsys::ContactList
- Inherits:
-
DataObject
- Object
- DataObject
- Emarsys::ContactList
- Defined in:
- lib/emarsys/data_objects/contact_list.rb
Overview
Methods for the ContactList API
Class Method Summary collapse
-
.add_contacts(id, key_id:, external_ids: [], account: nil) ⇒ Object
Add a contacts to a specific contact list.
-
.collection(account: nil) ⇒ Hash
List contact lists.
-
.contacts(id, account: nil) ⇒ Object
List contacts in a contact list Reference: dev.emarsys.com/v2/contact-lists/list-contacts-in-a-contact-list.
-
.create(account: nil, **params) ⇒ Hash
Internal id of the contact list.
- .delete(id, account: nil) ⇒ Object
-
.remove_contacts(id, key_id:, external_ids: [], account: nil) ⇒ Object
Remove contacts from a specific contact list.
Methods inherited from DataObject
get, parameterize_params, post, put, #request
Class Method Details
.add_contacts(id, key_id:, external_ids: [], account: nil) ⇒ Object
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?
53 54 55 |
# 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) ⇒ Hash
List contact lists
15 16 17 |
# File 'lib/emarsys/data_objects/contact_list.rb', line 15 def collection(account: nil) get account, 'contactlist', {} end |
.contacts(id, account: nil) ⇒ Object
List contacts in a contact list Reference: dev.emarsys.com/v2/contact-lists/list-contacts-in-a-contact-list
23 24 25 |
# File 'lib/emarsys/data_objects/contact_list.rb', line 23 def contacts(id, account: nil) get account, "contactlist/#{id}/", {} end |
.create(account: nil, **params) ⇒ Hash
Returns internal id of the contact list.
36 37 38 |
# File 'lib/emarsys/data_objects/contact_list.rb', line 36 def create(account: nil, **params) post account, "contactlist", params end |
.delete(id, account: nil) ⇒ Object
46 47 48 |
# 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) ⇒ Object
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?
60 61 62 |
# 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 |