Sha256: 4fed717e399107a0f62563fc760f104e497f48a9dba7ed1d68a9c21869a0e700

Contents?: true

Size: 825 Bytes

Versions: 11

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

module Mailersend
  # Messages endpoint from MailerSend API.
  class Messages
    attr_accessor :client,
                  :page,
                  :limit,
                  :message_id

    def initialize(client = Mailersend::Client.new)
      @client = client
      @page = page
      @limit = limit
      @message_id = message_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/messages",
                                                  query: URI.encode_www_form(hash)))
      puts response
    end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mailersend-ruby-0.2.0 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.9 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.8 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.7 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.6 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.5 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.4 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.3 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.2 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.1 lib/mailersend/messages/messages.rb
mailersend-ruby-0.1.0 lib/mailersend/messages/messages.rb