Class: Jsapi::Meta::SecurityScheme::HTTP::Basic

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

Overview

Specifies a security scheme based on HTTP basic authentication.

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

#to_openapi(version) ⇒ Object

Returns a hash representing the OpenAPI security scheme object.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jsapi/meta/security_scheme/http/basic.rb', line 12

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

  with_openapi_extensions(
    if version.major == 2
      {
        type: 'basic',
        description: description
      }
    else
      {
        type: 'http',
        scheme: 'basic',
        description: description
      }
    end
  )
end