13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/adp/api_connection_factory.rb', line 13
def self.createConnection( connectionCfg )
if connectionCfg.nil?
raise ConnectionException, "Configuration object expected, none provided"
else
classname = connectionCfg.class.name.split('::').last
case classname
when "AuthorizationCodeConfiguration"
return AuthorizationCodeConnection.new(connectionCfg)
when "ClientCredentialConfiguration"
return ClientCredentialConnection.new(connectionCfg)
else
raise ADPConnectionException, "Grant type / Configuration type not implemented. #{connectionCfg.grantType}"
end
end
end
|