Class: CheckoutSdk::CheckoutOAuthSdkBuilder
Instance Attribute Summary collapse
#environment, #http_client, #logger, #multipart_http_client, #subdomain
Instance Method Summary
collapse
#environment_subdomain, #initialize, #requires_environment_subdomain?, #with_environment, #with_environment_subdomain, #with_http_client, #with_legacy_domain, #with_logger, #with_multipart_http_client
Instance Attribute Details
#authorization_uri ⇒ String
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 12
class CheckoutOAuthSdkBuilder < AbstractCheckoutSdkBuilder
attr_accessor :client_id,
:client_secret,
:authorization_uri,
:scopes
def with_client_credentials(client_id, client_secret)
@client_id = client_id
@client_secret = client_secret
self
end
def with_authorization_uri(authorization_uri)
@authorization_uri = authorization_uri
self
end
def with_scopes(scopes)
@scopes = scopes
self
end
def build
super
env_subdomain = environment_subdomain
auth_uri = resolve_authorization_uri(env_subdomain)
configuration = CheckoutConfiguration.new(
OAuthSdkCredentials.new(client_id,
client_secret,
scopes,
http_client,
environment,
logger,
auth_uri),
environment,
http_client,
multipart_http_client,
logger
)
configuration.environment_subdomain = env_subdomain if env_subdomain
CheckoutApi.new(configuration)
end
private
def resolve_authorization_uri(env_subdomain)
auth_uri = authorization_uri
explicit_uri_set = !(auth_uri.nil? || auth_uri.empty?)
if explicit_uri_set && env_subdomain
raise CheckoutArgumentException,
'authorization_uri and environment_subdomain cannot both be set - the token ' \
'endpoint is derived from your subdomain; combine authorization_uri with ' \
'with_legacy_domain if you need a custom token host'
end
return auth_uri if explicit_uri_set
env_subdomain ? env_subdomain.authorization_uri : environment.authorization_uri
end
end
|
#client_id ⇒ String
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 12
class CheckoutOAuthSdkBuilder < AbstractCheckoutSdkBuilder
attr_accessor :client_id,
:client_secret,
:authorization_uri,
:scopes
def with_client_credentials(client_id, client_secret)
@client_id = client_id
@client_secret = client_secret
self
end
def with_authorization_uri(authorization_uri)
@authorization_uri = authorization_uri
self
end
def with_scopes(scopes)
@scopes = scopes
self
end
def build
super
env_subdomain = environment_subdomain
auth_uri = resolve_authorization_uri(env_subdomain)
configuration = CheckoutConfiguration.new(
OAuthSdkCredentials.new(client_id,
client_secret,
scopes,
http_client,
environment,
logger,
auth_uri),
environment,
http_client,
multipart_http_client,
logger
)
configuration.environment_subdomain = env_subdomain if env_subdomain
CheckoutApi.new(configuration)
end
private
def resolve_authorization_uri(env_subdomain)
auth_uri = authorization_uri
explicit_uri_set = !(auth_uri.nil? || auth_uri.empty?)
if explicit_uri_set && env_subdomain
raise CheckoutArgumentException,
'authorization_uri and environment_subdomain cannot both be set - the token ' \
'endpoint is derived from your subdomain; combine authorization_uri with ' \
'with_legacy_domain if you need a custom token host'
end
return auth_uri if explicit_uri_set
env_subdomain ? env_subdomain.authorization_uri : environment.authorization_uri
end
end
|
#client_secret ⇒ String
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 12
class CheckoutOAuthSdkBuilder < AbstractCheckoutSdkBuilder
attr_accessor :client_id,
:client_secret,
:authorization_uri,
:scopes
def with_client_credentials(client_id, client_secret)
@client_id = client_id
@client_secret = client_secret
self
end
def with_authorization_uri(authorization_uri)
@authorization_uri = authorization_uri
self
end
def with_scopes(scopes)
@scopes = scopes
self
end
def build
super
env_subdomain = environment_subdomain
auth_uri = resolve_authorization_uri(env_subdomain)
configuration = CheckoutConfiguration.new(
OAuthSdkCredentials.new(client_id,
client_secret,
scopes,
http_client,
environment,
logger,
auth_uri),
environment,
http_client,
multipart_http_client,
logger
)
configuration.environment_subdomain = env_subdomain if env_subdomain
CheckoutApi.new(configuration)
end
private
def resolve_authorization_uri(env_subdomain)
auth_uri = authorization_uri
explicit_uri_set = !(auth_uri.nil? || auth_uri.empty?)
if explicit_uri_set && env_subdomain
raise CheckoutArgumentException,
'authorization_uri and environment_subdomain cannot both be set - the token ' \
'endpoint is derived from your subdomain; combine authorization_uri with ' \
'with_legacy_domain if you need a custom token host'
end
return auth_uri if explicit_uri_set
env_subdomain ? env_subdomain.authorization_uri : environment.authorization_uri
end
end
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 12
class CheckoutOAuthSdkBuilder < AbstractCheckoutSdkBuilder
attr_accessor :client_id,
:client_secret,
:authorization_uri,
:scopes
def with_client_credentials(client_id, client_secret)
@client_id = client_id
@client_secret = client_secret
self
end
def with_authorization_uri(authorization_uri)
@authorization_uri = authorization_uri
self
end
def with_scopes(scopes)
@scopes = scopes
self
end
def build
super
env_subdomain = environment_subdomain
auth_uri = resolve_authorization_uri(env_subdomain)
configuration = CheckoutConfiguration.new(
OAuthSdkCredentials.new(client_id,
client_secret,
scopes,
http_client,
environment,
logger,
auth_uri),
environment,
http_client,
multipart_http_client,
logger
)
configuration.environment_subdomain = env_subdomain if env_subdomain
CheckoutApi.new(configuration)
end
private
def resolve_authorization_uri(env_subdomain)
auth_uri = authorization_uri
explicit_uri_set = !(auth_uri.nil? || auth_uri.empty?)
if explicit_uri_set && env_subdomain
raise CheckoutArgumentException,
'authorization_uri and environment_subdomain cannot both be set - the token ' \
'endpoint is derived from your subdomain; combine authorization_uri with ' \
'with_legacy_domain if you need a custom token host'
end
return auth_uri if explicit_uri_set
env_subdomain ? env_subdomain.authorization_uri : environment.authorization_uri
end
end
|
Instance Method Details
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 42
def build
super
env_subdomain = environment_subdomain
auth_uri = resolve_authorization_uri(env_subdomain)
configuration = CheckoutConfiguration.new(
OAuthSdkCredentials.new(client_id,
client_secret,
scopes,
http_client,
environment,
logger,
auth_uri),
environment,
http_client,
multipart_http_client,
logger
)
configuration.environment_subdomain = env_subdomain if env_subdomain
CheckoutApi.new(configuration)
end
|
29
30
31
32
|
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 29
def with_authorization_uri(authorization_uri)
@authorization_uri = authorization_uri
self
end
|
#with_client_credentials(client_id, client_secret) ⇒ CheckoutOAuthSdkBuilder
21
22
23
24
25
|
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 21
def with_client_credentials(client_id, client_secret)
@client_id = client_id
@client_secret = client_secret
self
end
|
36
37
38
39
|
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 36
def with_scopes(scopes)
@scopes = scopes
self
end
|