Class: A2A::SecurityScheme::HTTPAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/security_scheme/http_auth.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme:, bearer_format: nil, description: nil) ⇒ HTTPAuth

Returns a new instance of HTTPAuth.



8
9
10
11
12
# File 'lib/a2a/security_scheme/http_auth.rb', line 8

def initialize(scheme:, bearer_format: nil, description: nil)
  @scheme = scheme
  @bearer_format = bearer_format
  @description = description
end

Instance Attribute Details

#bearer_formatObject (readonly)

Returns the value of attribute bearer_format.



6
7
8
# File 'lib/a2a/security_scheme/http_auth.rb', line 6

def bearer_format
  @bearer_format
end

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/a2a/security_scheme/http_auth.rb', line 6

def description
  @description
end

#schemeObject (readonly)

Returns the value of attribute scheme.



6
7
8
# File 'lib/a2a/security_scheme/http_auth.rb', line 6

def scheme
  @scheme
end

Class Method Details

.from_h(hash) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/a2a/security_scheme/http_auth.rb', line 14

def self.from_h(hash)
  new(
    scheme: hash.fetch("scheme"),
    bearer_format: hash["bearerFormat"],
    description: hash["description"]
  )
end

Instance Method Details

#to_hObject



22
23
24
25
26
27
28
29
30
# File 'lib/a2a/security_scheme/http_auth.rb', line 22

def to_h
  {
    "httpAuthSecurityScheme" => {
      "scheme" => scheme,
      "bearerFormat" => bearer_format,
      "description" => description
    }.compact
  }
end