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 Model::Attributes

Model::Attributes::DEFAULT_ARRAY, Model::Attributes::DEFAULT_HASH

Instance Method Summary collapse

Methods included from OpenAPI::Extensions

included

Methods inherited from Base

#deprecated, #description

Methods inherited from Model::Base

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

Methods included from Model::Attributes

#attribute, #attribute_names

Constructor Details

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

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_openapi(version) ⇒ Object

Returns a hash representing the OpenAPI security scheme object.



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

def to_openapi(version, *)
  version = OpenAPI::Version.from(version)

  with_openapi_extensions(
    base_openapi_fields('apiKey', version).merge(name: name, in: self.in)
  )
end