Class: Mortymer::SecuritySchemes::ApiKey

Inherits:
Object
  • Object
show all
Defined in:
lib/mortymer/security_schemes.rb

Overview

Define the API Key security scheme

Class Method Summary collapse

Class Method Details

.scheme(scopes = [].freeze) ⇒ Object



23
24
25
# File 'lib/mortymer/security_schemes.rb', line 23

def self.scheme(scopes = [].freeze)
  { ApiKeyAuth: scopes }
end

.to_scheme(name: "X-API-Key", in: :header) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/mortymer/security_schemes.rb', line 27

def self.to_scheme(name: "X-API-Key", in: :header)
  {
    ApiKeyAuth: {
      type: :apiKey,
      name: name,
      in: binding.local_variable_get(:in) # Use binding because 'in' is a reserved word
    }
  }
end