Class: DigiwinDsp::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/digiwin_dsp/authenticator.rb

Constant Summary collapse

HEADER_NAME =
"DSP-api-key"

Instance Method Summary collapse

Constructor Details

#initialize(configuration = DigiwinDsp.configuration) ⇒ Authenticator

Returns a new instance of Authenticator.



7
8
9
# File 'lib/digiwin_dsp/authenticator.rb', line 7

def initialize(configuration = DigiwinDsp.configuration)
  @configuration = configuration
end

Instance Method Details

#auth_headersObject

Validation lives in Client#post (called per-request). Authenticator only ran validate! once per connection lifetime due to Client’s memoized #default_headers, so the redundant call was misleading.



14
15
16
# File 'lib/digiwin_dsp/authenticator.rb', line 14

def auth_headers
  { HEADER_NAME => @configuration.api_key }
end