class Mailersend::Recipients

Recipients endpoint from MailerSend API.

Attributes

client[RW]
limit[RW]
page[RW]
recipient_id[RW]

Public Class Methods

new(client = Mailersend::Client.new) click to toggle source
# File lib/mailersend/recipients/recipients.rb, line 11
def initialize(client = Mailersend::Client.new)
  @client = client
  @page = page
  @limit = limit
  @recipient_id = recipient_id
end

Public Instance Methods

delete(recipient_id:) click to toggle source
# File lib/mailersend/recipients/recipients.rb, line 34
def delete(recipient_id:)
  response = client.http.delete("#{API_URL}/recipients/#{recipient_id}")
  puts response
end
list(page: nil, limit: nil) click to toggle source
# File lib/mailersend/recipients/recipients.rb, line 18
def list(page: nil, limit: nil)
  hash = {
    'page' => page,
    'limit' => limit
  }

  response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/recipients',
                                              query: URI.encode_www_form(hash)))
  puts response
end
single(recipient_id:) click to toggle source
# File lib/mailersend/recipients/recipients.rb, line 29
def single(recipient_id:)
  response = client.http.get("#{API_URL}/recipients/#{recipient_id}")
  puts response
end