Module: Resend::Contacts::Topics
- Defined in:
- lib/resend/contacts/topics.rb
Overview
Module for managing contact topic subscriptions
Allows you to manage which topics contacts are subscribed to
Class Method Summary collapse
-
.list(params = {}) ⇒ Hash
Retrieve a list of topics subscriptions for a contact.
-
.update(params) ⇒ Hash
Update topic subscriptions for a contact.
Class Method Details
.list(params = {}) ⇒ Hash
Retrieve a list of topics subscriptions for a contact
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/resend/contacts/topics.rb', line 29 def list(params = {}) contact_identifier = params[:id] || params[:email] raise ArgumentError, "Either :id or :email must be provided" if contact_identifier.nil? pagination_params = params.slice(:limit, :after, :before) base_path = "contacts/#{contact_identifier}/topics" path = Resend::PaginationHelper.build_paginated_path(base_path, pagination_params) Resend::Request.new(path, {}, "get").perform end |
.update(params) ⇒ Hash
Update topic subscriptions for a contact
68 69 70 71 72 73 74 75 76 |
# File 'lib/resend/contacts/topics.rb', line 68 def update(params) contact_identifier = params[:id] || params[:email] raise ArgumentError, "Either :id or :email must be provided" if contact_identifier.nil? path = "contacts/#{contact_identifier}/topics" body = params[:topics] Resend::Request.new(path, body, "patch").perform end |