class Cobinhood::AuthRequestMiddleware

Public Class Methods

new(app, api_key) click to toggle source
Calls superclass method
# File lib/cobinhood/client/rest/auth_request_middleware.rb, line 4
def initialize app, api_key
  super(app)
  @api_key = api_key.to_s
end

Public Instance Methods

call(env) click to toggle source
# File lib/cobinhood/client/rest/auth_request_middleware.rb, line 9
def call env
  raise Cobinhood::MissingApiKeyError.new('API KEY not provided') if @api_key.empty?
  env[:request_headers]["authorization"] = @api_key
  @app.call(env)
end