class SendgridTemplate::Configuration

Constants

API_URL

Attributes

api_key[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/sendgrid_template/configuration.rb, line 8
def initialize(options = {})
  @api_key = options[:api_key]
end

Public Instance Methods

connect() click to toggle source
# File lib/sendgrid_template/configuration.rb, line 12
def connect
  @conn ||= Faraday.new(url: API_URL) do |h|
    h.headers[:content_type] = 'application/json'
    h.headers['Authorization'] = "Bearer #{@api_key}"
    h.adapter(Faraday.default_adapter)
  end

  @conn
end