Module: CardController::ApiKey

Defined in:
lib/card_controller/api_key.rb

Overview

add support for passing api key through header using X-API-Key

Instance Method Summary collapse

Instance Method Details

#api_key_from_headerObject



10
11
12
# File 'lib/card_controller/api_key.rb', line 10

def api_key_from_header
  request.headers["X-API-Key"]
end

#authenticatorsObject



4
5
6
7
8
# File 'lib/card_controller/api_key.rb', line 4

def authenticators
  return {} unless request

  super.merge api_key: api_key_from_header || params[:api_key]
end