Class: Jsapi::Meta::SecurityScheme::APIKey

Inherits:
Base show all
Includes:
OpenAPI::Extensions
Defined in:
lib/jsapi/meta/security_scheme/api_key.rb

Overview

Specifies a security scheme based on an API key.

Constant Summary

Constants included from Base::Attributes

Base::Attributes::DEFAULT_ARRAY, Base::Attributes::DEFAULT_HASH

Instance Method Summary collapse

Methods included from OpenAPI::Extensions

#add_openapi_extension, #openapi_extensions, #openapi_extensions=

Methods inherited from Base

#description

Methods inherited from Base::Model

#initialize, #inspect, #merge!, #reference?, #resolve

Methods included from Base::Attributes

#attribute, #attribute_names

Constructor Details

This class inherits a constructor from Jsapi::Meta::Base::Model

Instance Method Details

#inObject

:attr: in The location of the API key. Possible values are:

  • "cookie"

  • "header"

  • "query"



18
# File 'lib/jsapi/meta/security_scheme/api_key.rb', line 18

attribute :in, String, values: %w[cookie header query]

#nameObject

:attr: name The name of the header, query parameter or cookie the API key is sent by.



24
# File 'lib/jsapi/meta/security_scheme/api_key.rb', line 24

attribute :name, String

#to_openapiObject

Returns a hash representing the OpenAPI security scheme object.



27
28
29
30
31
32
33
34
# File 'lib/jsapi/meta/security_scheme/api_key.rb', line 27

def to_openapi(*)
  with_openapi_extensions(
    type: 'apiKey',
    name: name,
    in: self.in,
    description: description
  )
end