Sha256: b4c0326c46caec73de68c27652bfb24fae9732277267aff96b5220e8a016136c

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

# frozen_string_literal: true

module SendgridTemplate
  class Configuration
    API_URL = 'https://api.sendgrid.com'
    attr_accessor :api_key

    def initialize(options = {})
      @api_key = options[:api_key]
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sendgrid_template-0.0.5 lib/sendgrid_template/configuration.rb