Sha256: 47ff23cffd3b727a1ebd652187028c26568a3dc6559bcb111a100100104b13a9

Contents?: true

Size: 979 Bytes

Versions: 6

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: true

module Mailersend
  # Recipients endpoint from MailerSend API.
  class Recipients
    attr_accessor :client,
                  :page,
                  :limit,
                  :recipient_id

    def initialize(client = Mailersend::Client.new)
      @client = client
      @page = page
      @limit = limit
      @recipient_id = recipient_id
    end

    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

    def single(recipient_id:)
      response = client.http.get("#{API_URL}/recipients/#{recipient_id}")
      puts response
    end

    def delete(recipient_id:)
      response = client.http.delete("#{API_URL}/recipients/#{recipient_id}")
      puts response
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mailersend-ruby-1.0.0 lib/mailersend/recipients/recipients.rb
mailersend-ruby-0.2.5 lib/mailersend/recipients/recipients.rb
mailersend-ruby-0.2.4 lib/mailersend/recipients/recipients.rb
mailersend-ruby-0.2.3 lib/mailersend/recipients/recipients.rb
mailersend-ruby-0.2.2 lib/mailersend/recipients/recipients.rb
mailersend-ruby-0.2.1 lib/mailersend/recipients/recipients.rb