Sha256: 0705247695bedb22c477e72038e93d9eb56eab31df249e964c8a9faf42128dd0

Contents?: true

Size: 382 Bytes

Versions: 3

Compression:

Stored size: 382 Bytes

Contents

module Faraday
  class ApiKey < Faraday::Middleware

    def call(env)
      unless env[:request_headers]['X-Reviewed-Authorization']
        raise ::Reviewed::ConfigurationError.new("Please set the API key for your Reviewed::Client instance before making a request")
      end

      @app.call(env)
    end
  end
end

Faraday.register_middleware :request, api_key: Faraday::ApiKey

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reviewed-0.1.29 lib/faraday/api_key.rb
reviewed-0.1.28 lib/faraday/api_key.rb
reviewed-0.1.27 lib/faraday/api_key.rb