Class: Mailtrap::ContactsAPI
- Inherits:
-
Object
- Object
- Mailtrap::ContactsAPI
- Includes:
- BaseAPI
- Defined in:
- lib/mailtrap/contacts_api.rb
Instance Attribute Summary
Attributes included from BaseAPI
Instance Method Summary collapse
-
#add_to_lists(contact_id, contact_list_ids = []) ⇒ Contact
Adds a contact to specified lists.
-
#create(options) ⇒ Contact
Creates a new contact.
-
#delete(contact_id) ⇒ Object
Deletes a contact.
-
#get(contact_id) ⇒ Contact
Retrieves a specific contact.
-
#remove_from_lists(contact_id, contact_list_ids = []) ⇒ Contact
Removes a contact from specified lists.
-
#upsert(contact_id, options) ⇒ Contact
Updates an existing contact or creates a new one if it doesn’t exist.
Methods included from BaseAPI
Instance Method Details
#add_to_lists(contact_id, contact_list_ids = []) ⇒ Contact
Adds a contact to specified lists
59 60 61 |
# File 'lib/mailtrap/contacts_api.rb', line 59 def add_to_lists(contact_id, contact_list_ids = []) update_lists(contact_id, list_ids_included: contact_list_ids) end |
#create(options) ⇒ Contact
Creates a new contact
29 30 31 |
# File 'lib/mailtrap/contacts_api.rb', line 29 def create() base_create() end |
#delete(contact_id) ⇒ Object
Deletes a contact
37 38 39 |
# File 'lib/mailtrap/contacts_api.rb', line 37 def delete(contact_id) base_delete(contact_id) end |
#get(contact_id) ⇒ Contact
Retrieves a specific contact
17 18 19 |
# File 'lib/mailtrap/contacts_api.rb', line 17 def get(contact_id) base_get(contact_id) end |
#remove_from_lists(contact_id, contact_list_ids = []) ⇒ Contact
Removes a contact from specified lists
68 69 70 |
# File 'lib/mailtrap/contacts_api.rb', line 68 def remove_from_lists(contact_id, contact_list_ids = []) update_lists(contact_id, list_ids_excluded: contact_list_ids) end |
#upsert(contact_id, options) ⇒ Contact
Updates an existing contact or creates a new one if it doesn’t exist
50 51 52 |
# File 'lib/mailtrap/contacts_api.rb', line 50 def upsert(contact_id, ) base_update(contact_id, , %i[email fields unsubscribed]) end |