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

Inherits:
Base
  • Object
show all
Defined in:
lib/jsapi/meta/openapi/security_scheme/api_key.rb

Overview

Represents a security scheme based on an API key.

Instance Method Summary collapse

Methods inherited from Base

#description

Methods inherited from Base

#initialize, #inspect, #reference?, #resolve

Methods included from Attributes::ClassMethods

#attribute, #attribute_names

Constructor Details

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

Instance Method Details

#inObject

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

  • "cookie"

  • "header"

  • "query"



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

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.



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

attribute :name, String

#to_openapiObject

Returns a hash representing the security scheme object.



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

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