Class: Ingenico::Connect::SDK::CommunicatorConfiguration

Inherits:
EndpointConfiguration show all
Defined in:
lib/ingenico/connect/sdk/communicator_configuration.rb

Overview

A CommunicatorConfiguration stores all data used to initialize an Communicator. It stores the following:

api_endpoint

The base url to the GlobalCollect platform.

api_key_id

The identifier of the secret_api_key used to authenticate requests.

secret_api_key

The key used to authenticate requests sent to the GlobalCollect platform.

authorization_type

String describing the authorization protocol to follow.

connect_timeout

The number of seconds before a connection attempt with the GlobalCollect platform times out.

socket_timeout

The number of seconds before a timeout occurs when transmitting data to or from the GlobalCollect platform.

max_connections

The number of connections with the GlobalCollect platform that are kept alive in the connection pool. These connections will be reused when possible.

proxy_configuration

ProxyConfiguration instance that stores the url to a proxy to be used in all communication, or nil if no proxy should be used.

integrator

String

shopping_cart_extension

Domain::Metadata::ShoppingCartExtension that stores shopping cart-related metadata.

Instance Attribute Summary collapse

Attributes inherited from EndpointConfiguration

#connect_timeout, #integrator, #max_connections, #proxy_configuration, #shopping_cart_extension, #socket_timeout

Instance Method Summary collapse

Methods inherited from EndpointConfiguration

DEFAULT_MAX_CONNECTIONS

Constructor Details

#initialize(properties: nil, api_endpoint: nil, api_key_id: nil, secret_api_key: nil, authorization_type: nil, connect_timeout: nil, socket_timeout: nil, max_connections: nil, proxy_configuration: nil, integrator: nil, shopping_cart_extension: nil) ⇒ CommunicatorConfiguration

Creates a new CommunicatorConfiguration instance, it accepts the following arguments:

properties

A hash that may contain any of the other parameters. If a parameter is given in both the properties and separately, the separate value takes precedence.

api_endpoint

The base url to the GlobalCollect platform.

api_key_id

The identifier of the secret_api_key used to authenticate requests.

secret_api_key

The key used to authenticate requests sent to the GlobalCollect platform.

authorization_type

String describing the authorization protocol to follow.

connect_timeout

The number of seconds before a connection attempt with the GlobalCollect platform times out.

socket_timeout

The number of seconds before a timeout occurs when transmitting data to or from the GlobalCollect platform.

max_connections

The number of connections with the GlobalCollect platform that are kept alive in the connection pool. These connections will be reused when possible.

proxy_configuration

ProxyConfiguration instance that stores the url to a proxy to be used in all communication, or nil if no proxy should be used.

integrator

String

shopping_cart_extension

Domain::Metadata::ShoppingCartExtension that stores shopping cart-related metadata.

If a properties object is given, it will be parsed like a hash in order to read these attributes. If a value is given in both the properties hash and as a separate parameter, the separate parameter will take precedence over the value in the properties.



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
# File 'lib/ingenico/connect/sdk/communicator_configuration.rb', line 42

def initialize(properties: nil, api_endpoint: nil, api_key_id: nil,
               secret_api_key: nil, authorization_type: nil,
               connect_timeout: nil, socket_timeout: nil,
               max_connections: nil, proxy_configuration: nil,
               integrator: nil, shopping_cart_extension: nil)
  if properties
    super(properties, 'connect.api')
    unless properties.nil?
      @authorization_type = DefaultImpl::AuthorizationType.get_authorization(
          properties['connect.api.authorizationType'])
    end
  end
  if api_endpoint
    @api_endpoint = api_endpoint
  end
  if api_key_id
    @api_key_id = api_key_id
  end
  if secret_api_key
    @secret_api_key = secret_api_key
  end
  if authorization_type
    @authorization_type = authorization_type
  end
  if connect_timeout
    @connect_timeout = connect_timeout
  end
  if socket_timeout
    @socket_timeout = socket_timeout
  end
  if max_connections
    @max_connections = max_connections
  end
  if proxy_configuration
    @proxy_configuration = proxy_configuration
  end
  if integrator
    @integrator = integrator
  end
  if shopping_cart_extension
    @shopping_cart_extension = shopping_cart_extension
  end
end

Instance Attribute Details

#api_endpointObject

Base URL to the GlobalCollect platform



87
88
89
# File 'lib/ingenico/connect/sdk/communicator_configuration.rb', line 87

def api_endpoint
  @api_endpoint
end

#api_key_idObject

Identifier of the secret_api_key used in authentication.



90
91
92
# File 'lib/ingenico/connect/sdk/communicator_configuration.rb', line 90

def api_key_id
  @api_key_id
end

#authorization_typeObject

String representing the authentication algorithm used



96
97
98
# File 'lib/ingenico/connect/sdk/communicator_configuration.rb', line 96

def authorization_type
  @authorization_type
end

#secret_api_keyObject

Secret key used in authentication



93
94
95
# File 'lib/ingenico/connect/sdk/communicator_configuration.rb', line 93

def secret_api_key
  @secret_api_key
end