Class: CheckoutSdk::CheckoutOAuthSdkBuilder

Inherits:
AbstractCheckoutSdkBuilder show all
Defined in:
lib/checkout_sdk/checkout_oauth_sdk_builder.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractCheckoutSdkBuilder

#environment, #environment_subdomain, #http_client, #logger, #multipart_http_client

Instance Method Summary collapse

Methods inherited from AbstractCheckoutSdkBuilder

#with_environment, #with_environment_subdomain, #with_http_client, #with_logger, #with_multipart_http_client

Instance Attribute Details

#authorization_uriString

Returns:

  • (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
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 12

class CheckoutOAuthSdkBuilder < AbstractCheckoutSdkBuilder
  attr_accessor :client_id,
                :client_secret,
                :authorization_uri,
                :scopes

  # @param [String] client_id
  # @param [String] client_secret
  # @return [CheckoutOAuthSdkBuilder]
  def with_client_credentials(client_id, client_secret)
    @client_id = client_id
    @client_secret = client_secret
    self
  end

  # @param [String] authorization_uri
  # @return [CheckoutOAuthSdkBuilder]
  def with_authorization_uri(authorization_uri)
    @authorization_uri = authorization_uri
    self
  end

  # @param [Array(CheckoutSdk::OAuthScopes)] scopes
  # @return [CheckoutOAuthSdkBuilder]
  def with_scopes(scopes)
    @scopes = scopes
    self
  end

  # @return [CheckoutSdk::CheckoutApi]
  def build
    super

    # Determine authorization URI following Go logic
    auth_uri = authorization_uri
    if auth_uri.nil? || auth_uri.empty?
      auth_uri = if environment_subdomain
                   environment_subdomain.authorization_uri
                 else
                   environment.authorization_uri
                 end
    end

    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 = environment_subdomain if environment_subdomain

    CheckoutApi.new(configuration)
  end
end

#client_idString

Returns:

  • (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
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 12

class CheckoutOAuthSdkBuilder < AbstractCheckoutSdkBuilder
  attr_accessor :client_id,
                :client_secret,
                :authorization_uri,
                :scopes

  # @param [String] client_id
  # @param [String] client_secret
  # @return [CheckoutOAuthSdkBuilder]
  def with_client_credentials(client_id, client_secret)
    @client_id = client_id
    @client_secret = client_secret
    self
  end

  # @param [String] authorization_uri
  # @return [CheckoutOAuthSdkBuilder]
  def with_authorization_uri(authorization_uri)
    @authorization_uri = authorization_uri
    self
  end

  # @param [Array(CheckoutSdk::OAuthScopes)] scopes
  # @return [CheckoutOAuthSdkBuilder]
  def with_scopes(scopes)
    @scopes = scopes
    self
  end

  # @return [CheckoutSdk::CheckoutApi]
  def build
    super

    # Determine authorization URI following Go logic
    auth_uri = authorization_uri
    if auth_uri.nil? || auth_uri.empty?
      auth_uri = if environment_subdomain
                   environment_subdomain.authorization_uri
                 else
                   environment.authorization_uri
                 end
    end

    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 = environment_subdomain if environment_subdomain

    CheckoutApi.new(configuration)
  end
end

#client_secretString

Returns:

  • (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
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 12

class CheckoutOAuthSdkBuilder < AbstractCheckoutSdkBuilder
  attr_accessor :client_id,
                :client_secret,
                :authorization_uri,
                :scopes

  # @param [String] client_id
  # @param [String] client_secret
  # @return [CheckoutOAuthSdkBuilder]
  def with_client_credentials(client_id, client_secret)
    @client_id = client_id
    @client_secret = client_secret
    self
  end

  # @param [String] authorization_uri
  # @return [CheckoutOAuthSdkBuilder]
  def with_authorization_uri(authorization_uri)
    @authorization_uri = authorization_uri
    self
  end

  # @param [Array(CheckoutSdk::OAuthScopes)] scopes
  # @return [CheckoutOAuthSdkBuilder]
  def with_scopes(scopes)
    @scopes = scopes
    self
  end

  # @return [CheckoutSdk::CheckoutApi]
  def build
    super

    # Determine authorization URI following Go logic
    auth_uri = authorization_uri
    if auth_uri.nil? || auth_uri.empty?
      auth_uri = if environment_subdomain
                   environment_subdomain.authorization_uri
                 else
                   environment.authorization_uri
                 end
    end

    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 = environment_subdomain if environment_subdomain

    CheckoutApi.new(configuration)
  end
end

#scopesArray(CheckoutSdk::OAuthScopes)

Returns:



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
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 12

class CheckoutOAuthSdkBuilder < AbstractCheckoutSdkBuilder
  attr_accessor :client_id,
                :client_secret,
                :authorization_uri,
                :scopes

  # @param [String] client_id
  # @param [String] client_secret
  # @return [CheckoutOAuthSdkBuilder]
  def with_client_credentials(client_id, client_secret)
    @client_id = client_id
    @client_secret = client_secret
    self
  end

  # @param [String] authorization_uri
  # @return [CheckoutOAuthSdkBuilder]
  def with_authorization_uri(authorization_uri)
    @authorization_uri = authorization_uri
    self
  end

  # @param [Array(CheckoutSdk::OAuthScopes)] scopes
  # @return [CheckoutOAuthSdkBuilder]
  def with_scopes(scopes)
    @scopes = scopes
    self
  end

  # @return [CheckoutSdk::CheckoutApi]
  def build
    super

    # Determine authorization URI following Go logic
    auth_uri = authorization_uri
    if auth_uri.nil? || auth_uri.empty?
      auth_uri = if environment_subdomain
                   environment_subdomain.authorization_uri
                 else
                   environment.authorization_uri
                 end
    end

    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 = environment_subdomain if environment_subdomain

    CheckoutApi.new(configuration)
  end
end

Instance Method Details

#buildCheckoutSdk::CheckoutApi



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
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 42

def build
  super

  # Determine authorization URI following Go logic
  auth_uri = authorization_uri
  if auth_uri.nil? || auth_uri.empty?
    auth_uri = if environment_subdomain
                 environment_subdomain.authorization_uri
               else
                 environment.authorization_uri
               end
  end

  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 = environment_subdomain if environment_subdomain

  CheckoutApi.new(configuration)
end

#with_authorization_uri(authorization_uri) ⇒ CheckoutOAuthSdkBuilder

Parameters:

  • authorization_uri (String)

Returns:



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

Parameters:

  • client_id (String)
  • client_secret (String)

Returns:



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

#with_scopes(scopes) ⇒ CheckoutOAuthSdkBuilder

Parameters:

Returns:



36
37
38
39
# File 'lib/checkout_sdk/checkout_oauth_sdk_builder.rb', line 36

def with_scopes(scopes)
  @scopes = scopes
  self
end