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

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

Overview

Represents a security scheme based on HTTP basic authentication.

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

#to_openapi(version) ⇒ Object

Returns a hash representing the security scheme object.



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

def to_openapi(version)
  version = OpenAPI::Version.from(version)
  if version.major == 2
    {
      type: 'basic',
      description: description
    }
  else
    {
      type: 'http',
      scheme: 'basic',
      description: description
    }
  end.compact
end