module Mailgat

Constants

VERSION

Attributes

client[W]
configuration[R]

Public Class Methods

client() click to toggle source
# File lib/mailgat.rb, line 37
def self.client
  @client || configure
end
client_auth_header() click to toggle source
# File lib/mailgat.rb, line 41
def self.client_auth_header
  { "Authorization" =>
      "Basic #{ Base64.encode64(["api", configuration.public_key].join(":")).gsub!("\n", "") }" }
end
configure() { |configuration| ... } click to toggle source

Configure client

@yield [configuration] configuration object to defining client paramters @example

Mailgat.configure do |config|
  config.api_key = "XYZ"
  config.adapter = :typhoeus
end
# File lib/mailgat.rb, line 23
def self.configure(&block)
  @configuration ||= Configuration.new
  yield(@configuration) if block_given?

  self.client = Faraday.new(@configuration.api_base) do |connection|
    connection.basic_auth "api", @configuration.api_key
    connection.request :url_encoded
    connection.response :logger
    connection.response :mashify
    connection.response :json, content_type: /\bjson$/
    connection.adapter @configuration.adapter
  end
end