Class: Worldline::Connect::SDK::CommunicatorConfiguration
- Inherits:
-
Object
- Object
- Worldline::Connect::SDK::CommunicatorConfiguration
- Defined in:
- lib/worldline/connect/sdk/communicator_configuration.rb
Overview
A CommunicatorConfiguration stores all data used to initialize an Communicator.
Instance Attribute Summary collapse
-
#api_endpoint ⇒ String
Base URL to the Worldline Global Collect platform.
-
#authorization_id ⇒ String
(also: #api_key_id)
An id used for authorization.
-
#authorization_secret ⇒ String
(also: #secret_api_key)
A secret used for authorization.
-
#authorization_type ⇒ String
String representing the authentication algorithm used.
-
#connect_timeout ⇒ Integer
The number of seconds before a connection attempt with the Worldline Global Collect platform times out.
-
#integrator ⇒ String
Name of the integrator.
-
#max_connections ⇒ Integer
The number of connections with the Worldline Global Collect platform that are kept alive in the connection pool.
-
#proxy_configuration ⇒ Worldline::Connect::SDK::ProxyConfiguration
Proxy settings.
-
#shopping_cart_extension ⇒ Worldline::Connect::SDK::Domain::ShoppingCartExtension
Shopping cart-related metadata.
-
#socket_timeout ⇒ Integer
The number of seconds before a timeout occurs when transmitting data to or from the Worldline Global Collect platform.
Class Method Summary collapse
-
.default_max_connections ⇒ Integer
The default number of connections that are kept alive in the connection pool.
Instance Method Summary collapse
-
#initialize(properties: nil, api_endpoint: nil, authorization_id: nil, authorization_secret: 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
constructor
Creates a new CommunicatorConfiguration instance.
Constructor Details
#initialize(properties: nil, api_endpoint: nil, authorization_id: nil, authorization_secret: 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.
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.
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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 60 def initialize(properties: nil, api_endpoint: nil, authorization_id: nil, authorization_secret: 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) unless properties.nil? @api_endpoint = get_endpoint(properties) @authorization_type = Authentication::AuthorizationType.(properties['connect.api.authorizationType']) @connect_timeout = properties['connect.api.connectTimeout'] @socket_timeout = properties['connect.api.socketTimeout'] @max_connections = get_property(properties, 'connect.api.maxConnections', DEFAULT_MAX_CONNECTIONS) proxy_uri = properties['connect.api.proxy.uri'] proxy_user = properties['connect.api.proxy.username'] proxy_pass = properties['connect.api.proxy.password'] unless proxy_uri.nil? @proxy_configuration = ProxyConfiguration.new(address: URI(proxy_uri), username: proxy_user, password: proxy_pass) end @integrator = properties['connect.api.integrator'] @shopping_cart_extension = get_shopping_cart_extension(properties) end if api_endpoint @api_endpoint = api_endpoint end if @authorization_id = end if @authorization_secret = end if api_key_id @authorization_id = api_key_id end if secret_api_key @authorization_secret = secret_api_key end if @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_endpoint ⇒ String
Base URL to the Worldline Global Collect platform
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def api_endpoint @api_endpoint end |
#authorization_id ⇒ String Also known as: api_key_id
An id used for authorization. The meaning of this id is different for each authorization type. For instance, for v1HMAC this is the identifier for the secret API key
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def @authorization_id end |
#authorization_secret ⇒ String Also known as: secret_api_key
A secret used for authorization. The meaning of this secret is different for each authorization type. For instance, for v1HMAC this is the secret API key
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def @authorization_secret end |
#authorization_type ⇒ String
String representing the authentication algorithm used
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def @authorization_type end |
#connect_timeout ⇒ Integer
The number of seconds before a connection attempt with the Worldline Global Collect platform times out.
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def connect_timeout @connect_timeout end |
#integrator ⇒ String
Name of the integrator
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def integrator @integrator end |
#max_connections ⇒ Integer
The number of connections with the Worldline Global Collect platform that are kept alive in the connection pool. These connections will be reused when possible.
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def max_connections @max_connections end |
#proxy_configuration ⇒ Worldline::Connect::SDK::ProxyConfiguration
Proxy settings.
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def proxy_configuration @proxy_configuration end |
#shopping_cart_extension ⇒ Worldline::Connect::SDK::Domain::ShoppingCartExtension
Shopping cart-related metadata.
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def shopping_cart_extension @shopping_cart_extension end |
#socket_timeout ⇒ Integer
The number of seconds before a timeout occurs when transmitting data to or from the Worldline Global Collect platform.
21 22 23 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 21 def socket_timeout @socket_timeout end |
Class Method Details
.default_max_connections ⇒ Integer
The default number of connections that are kept alive in the connection pool. Used if maxConnections is not present in the properties.
31 32 33 |
# File 'lib/worldline/connect/sdk/communicator_configuration.rb', line 31 def self.default_max_connections DEFAULT_MAX_CONNECTIONS end |