Class: CheckoutSdk::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/checkout_sdk/client.rb

Instance Attribute Summary collapse

Instance Attribute Details

#api_clientApiClient

Returns:



10
11
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
# File 'lib/checkout_sdk/client.rb', line 10

class Client
  attr_reader :api_client,
              :authorization_type,
              :configuration

  protected

  # @param [CheckoutSdk::ApiClient] api_client
  # @param [CheckoutConfiguration] configuration
  # @param [String] authorization_type {AuthorizationType}
  def initialize(api_client, configuration, authorization_type)
    @api_client = api_client
    @authorization_type = authorization_type
    @configuration = configuration
  end

  # @param [Array] args
  def build_path(*args)
    args.join('/')
  end

  # @return [TrueClass, FalseClass]
  def sandbox?
    @configuration.environment.is_sandbox
  end

  # @param [String, nil] authorization_type {AuthorizationType}
  def sdk_authorization(authorization_type = nil)
    if authorization_type.nil?
      configuration.credentials.get_authorization(@authorization_type)
    else
      configuration.credentials.get_authorization(authorization_type)
    end
  end
end

#authorization_typeCheckoutConfiguration



10
11
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
# File 'lib/checkout_sdk/client.rb', line 10

class Client
  attr_reader :api_client,
              :authorization_type,
              :configuration

  protected

  # @param [CheckoutSdk::ApiClient] api_client
  # @param [CheckoutConfiguration] configuration
  # @param [String] authorization_type {AuthorizationType}
  def initialize(api_client, configuration, authorization_type)
    @api_client = api_client
    @authorization_type = authorization_type
    @configuration = configuration
  end

  # @param [Array] args
  def build_path(*args)
    args.join('/')
  end

  # @return [TrueClass, FalseClass]
  def sandbox?
    @configuration.environment.is_sandbox
  end

  # @param [String, nil] authorization_type {AuthorizationType}
  def sdk_authorization(authorization_type = nil)
    if authorization_type.nil?
      configuration.credentials.get_authorization(@authorization_type)
    else
      configuration.credentials.get_authorization(authorization_type)
    end
  end
end

#configurationString

Returns:



10
11
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
# File 'lib/checkout_sdk/client.rb', line 10

class Client
  attr_reader :api_client,
              :authorization_type,
              :configuration

  protected

  # @param [CheckoutSdk::ApiClient] api_client
  # @param [CheckoutConfiguration] configuration
  # @param [String] authorization_type {AuthorizationType}
  def initialize(api_client, configuration, authorization_type)
    @api_client = api_client
    @authorization_type = authorization_type
    @configuration = configuration
  end

  # @param [Array] args
  def build_path(*args)
    args.join('/')
  end

  # @return [TrueClass, FalseClass]
  def sandbox?
    @configuration.environment.is_sandbox
  end

  # @param [String, nil] authorization_type {AuthorizationType}
  def sdk_authorization(authorization_type = nil)
    if authorization_type.nil?
      configuration.credentials.get_authorization(@authorization_type)
    else
      configuration.credentials.get_authorization(authorization_type)
    end
  end
end