Class: Jsapi::Meta::OpenAPI::SecurityScheme::HTTP::Other

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

Overview

Represents a security scheme based on any other HTTP authentication than basic and bearer.

Note that OpenAPI 2.0 supports HTTP basic authentication only. Thus, a security scheme of this class is skipped when generating an OpenAPI 2.0 document.

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

#schemeObject

:attr: scheme The mandatory HTTP authentication scheme.



18
# File 'lib/jsapi/meta/openapi/security_scheme/http/other.rb', line 18

attribute :scheme, String

#to_openapi(version) ⇒ Object

Returns a hash representing the security scheme object, or nil if version.major is 2.



22
23
24
25
26
27
28
29
30
31
# File 'lib/jsapi/meta/openapi/security_scheme/http/other.rb', line 22

def to_openapi(version)
  version = OpenAPI::Version.from(version)
  return if version.major == 2

  {
    type: 'http',
    scheme: scheme,
    description: description
  }.compact
end