Sha256: aa30f43c6603f40b7bd94e5e03d19ac9a054385f2d732fb54e88c420b3d8f909

Contents?: true

Size: 701 Bytes

Versions: 11

Compression:

Stored size: 701 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('MAILERSEND_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['MAILERSEND_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/#{Mailersend::VERSION}",
                 'Accept' => 'application/json')
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mailersend-ruby-1.6.0 lib/mailersend/client.rb
mailersend-ruby-1.5.2 lib/mailersend/client.rb
mailersend-ruby-1.5.1 lib/mailersend/client.rb
mailersend-ruby-1.5.0 lib/mailersend/client.rb
mailersend-ruby-1.4.0 lib/mailersend/client.rb
mailersend-ruby-1.3.2 lib/mailersend/client.rb
mailersend-ruby-1.3.1 lib/mailersend/client.rb
mailersend-ruby-1.3.0 lib/mailersend/client.rb
mailersend-ruby-1.2.0 lib/mailersend/client.rb
mailersend-ruby-1.1.0 lib/mailersend/client.rb
mailersend-ruby-1.0.1 lib/mailersend/client.rb