Module: A2A::OAuthFlow

Defined in:
lib/a2a/oauth_flow.rb,
lib/a2a/oauth_flow/device_code.rb,
lib/a2a/oauth_flow/authorization_code.rb,
lib/a2a/oauth_flow/client_credentials.rb

Defined Under Namespace

Classes: AuthorizationCode, ClientCredentials, DeviceCode

Constant Summary collapse

FLOW_KEYS =
%w[authorizationCode clientCredentials deviceCode].freeze
DEPRECATED_FLOW_KEYS =
%w[implicit password].freeze

Class Method Summary collapse

Class Method Details

.from_h(hash) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
# File 'lib/a2a/oauth_flow.rb', line 12

def self.from_h(hash)
  reject_deprecated!(hash)
  matched = FLOW_KEYS.count { |k| hash.key?(k) }
  raise ArgumentError, "OAuthFlows must contain exactly one flow type, got #{matched}" unless matched == 1

  build_flows(hash)
end