Class: A2A::OAuthFlow::AuthorizationCode

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/oauth_flow/authorization_code.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authorization_url:, token_url:, scopes:, refresh_url: nil, pkce_required: nil) ⇒ AuthorizationCode

Returns a new instance of AuthorizationCode.



8
9
10
11
12
13
14
# File 'lib/a2a/oauth_flow/authorization_code.rb', line 8

def initialize(authorization_url:, token_url:, scopes:, refresh_url: nil, pkce_required: nil)
  @authorization_url = authorization_url
  @token_url = token_url
  @scopes = scopes
  @refresh_url = refresh_url
  @pkce_required = pkce_required
end

Instance Attribute Details

#authorization_urlObject (readonly)

Returns the value of attribute authorization_url.



6
7
8
# File 'lib/a2a/oauth_flow/authorization_code.rb', line 6

def authorization_url
  @authorization_url
end

#pkce_requiredObject (readonly)

Returns the value of attribute pkce_required.



6
7
8
# File 'lib/a2a/oauth_flow/authorization_code.rb', line 6

def pkce_required
  @pkce_required
end

#refresh_urlObject (readonly)

Returns the value of attribute refresh_url.



6
7
8
# File 'lib/a2a/oauth_flow/authorization_code.rb', line 6

def refresh_url
  @refresh_url
end

#scopesObject (readonly)

Returns the value of attribute scopes.



6
7
8
# File 'lib/a2a/oauth_flow/authorization_code.rb', line 6

def scopes
  @scopes
end

#token_urlObject (readonly)

Returns the value of attribute token_url.



6
7
8
# File 'lib/a2a/oauth_flow/authorization_code.rb', line 6

def token_url
  @token_url
end

Class Method Details

.from_h(hash) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/a2a/oauth_flow/authorization_code.rb', line 16

def self.from_h(hash)
  new(
    authorization_url: hash.fetch("authorizationUrl"),
    scopes: hash.fetch("scopes"),
    token_url: hash.fetch("tokenUrl"),
    refresh_url: hash["refreshUrl"],
    pkce_required: hash["pkceRequired"]
  )
end

Instance Method Details

#to_hObject



26
27
28
29
30
31
32
33
34
# File 'lib/a2a/oauth_flow/authorization_code.rb', line 26

def to_h
  {
    "authorizationUrl" => authorization_url,
    "tokenUrl" => token_url,
    "scopes" => scopes,
    "refreshUrl" => refresh_url,
    "pkceRequired" => pkce_required
  }.compact
end