Class: A2A::SecurityScheme::OAuth2
- Inherits:
-
Object
- Object
- A2A::SecurityScheme::OAuth2
- Defined in:
- lib/a2a/security_scheme/oauth2.rb
Constant Summary collapse
- FLOW_TYPES =
[ OAuthFlow::AuthorizationCode, OAuthFlow::ClientCredentials, OAuthFlow::DeviceCode ].freeze
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#flows ⇒ Object
readonly
Returns the value of attribute flows.
-
#oauth2_metadata_url ⇒ Object
readonly
Returns the value of attribute oauth2_metadata_url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(flows:, oauth2_metadata_url: nil, description: nil) ⇒ OAuth2
constructor
A new instance of OAuth2.
- #to_h ⇒ Object
Constructor Details
#initialize(flows:, oauth2_metadata_url: nil, description: nil) ⇒ OAuth2
Returns a new instance of OAuth2.
14 15 16 17 18 19 20 21 22 |
# File 'lib/a2a/security_scheme/oauth2.rb', line 14 def initialize(flows:, oauth2_metadata_url: nil, description: nil) unless flows.is_a?(Hash) && flows.size == 1 && FLOW_TYPES.any? { |t| flows.values.first.is_a?(t) } raise ArgumentError, "flows must be a Hash with exactly one OAuthFlow entry" end @flows = flows @oauth2_metadata_url = @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/a2a/security_scheme/oauth2.rb', line 6 def description @description end |
#flows ⇒ Object (readonly)
Returns the value of attribute flows.
6 7 8 |
# File 'lib/a2a/security_scheme/oauth2.rb', line 6 def flows @flows end |
#oauth2_metadata_url ⇒ Object (readonly)
Returns the value of attribute oauth2_metadata_url.
6 7 8 |
# File 'lib/a2a/security_scheme/oauth2.rb', line 6 def @oauth2_metadata_url end |
Class Method Details
Instance Method Details
#to_h ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/a2a/security_scheme/oauth2.rb', line 32 def to_h { "oauth2SecurityScheme" => { "flows" => serialize_flows, "oauth2MetadataUrl" => , "description" => description }.compact } end |