Module: Resend::Contacts

Defined in:
lib/resend/contacts.rb

Overview

Contacts api wrapper

Class Method Summary collapse

Class Method Details

.create(params) ⇒ Object



11
12
13
14
# File 'lib/resend/contacts.rb', line 11

def create(params)
  path = "audiences/#{params[:audience_id]}/contacts"
  Resend::Request.new(path, params, "post").perform
end

.get(audience_id, id) ⇒ Object



17
18
19
20
# File 'lib/resend/contacts.rb', line 17

def get(audience_id, id)
  path = "audiences/#{audience_id}/contacts/#{id}"
  Resend::Request.new(path, {}, "get").perform
end

.list(audience_id) ⇒ Object



23
24
25
26
# File 'lib/resend/contacts.rb', line 23

def list(audience_id)
  path = "audiences/#{audience_id}/contacts"
  Resend::Request.new(path, {}, "get").perform
end

.remove(audience_id, contact_id) ⇒ Object

Remove a contact from an audience

see also: resend.com/docs/api-reference/contacts/delete-contact

Parameters:

  • audience_id (String)

    the audience id

  • contact_id (String)

    either the contact id or contact email



35
36
37
38
# File 'lib/resend/contacts.rb', line 35

def remove(audience_id, contact_id)
  path = "audiences/#{audience_id}/contacts/#{contact_id}"
  Resend::Request.new(path, {}, "delete").perform
end

.update(params) ⇒ Object



41
42
43
44
# File 'lib/resend/contacts.rb', line 41

def update(params)
  path = "audiences/#{params[:audience_id]}/contacts/#{params[:id]}"
  Resend::Request.new(path, params, "patch").perform
end