Sha256: 78f375f2ac1048071226ce8db15999930008008f721fb599fab9f3926accce84

Contents?: true

Size: 662 Bytes

Versions: 10

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

require "http"
require "dotenv/load"

API_URL = "https://api.mailersend.com/v1"
API_BASE_HOST = "api.mailersend.com"

Dotenv.require_keys("API_TOKEN")

# mailersend-ruby is a gem that integrates all endpoints from MailerSend API
module Mailersend
  attr_reader :api_token

  # Inits the client.
  class Client
    def initialize(api_token = ENV["API_TOKEN"])
      @api_token = api_token
    end

    def http
      HTTP
        .timeout(connect: 15, read: 30)
        .auth("Bearer #{@api_token}")
        .headers("User-Agent" => "MailerSend-client-ruby/1.0.0",
                 "Accept" => "application/json")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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