Class: Ingenico::Connect::SDK::EndpointConfiguration
- Inherits:
-
Object
- Object
- Ingenico::Connect::SDK::EndpointConfiguration
- Defined in:
- lib/ingenico/connect/sdk/endpoint_configuration.rb
Overview
Base class for configuration classes in the SDK.
Direct Known Subclasses
Constant Summary collapse
- @@DEFAULT_MAX_CONNECTIONS =
10
Instance Attribute Summary collapse
-
#api_endpoint ⇒ String
The base URL to the Ingenico ePayments platform.
-
#connect_timeout ⇒ Integer
The number of seconds before a connection attempt with the Ingenico ePayments platform times out.
-
#integrator ⇒ String
Name of the integrator.
-
#max_connections ⇒ Integer
The number of connections with the Ingenico ePayments platform that are kept alive in the connection pool.
-
#proxy_configuration ⇒ Ingenico::Connect::SDK::ProxyConfiguration
Proxy settings.
-
#shopping_cart_extension ⇒ Ingenico::Connect::SDK::Domain::Metadata::ShoppingCartExtension
Shopping cart-related metadata.
-
#socket_timeout ⇒ Integer
The number of seconds before a timeout occurs when transmitting data to or from the Ingenico ePayments platform.
Class Method Summary collapse
-
.DEFAULT_MAX_CONNECTIONS ⇒ Object
The default number of connections that are kept alive in the connection pool.
Instance Method Summary collapse
-
#initialize(properties = nil, prefix = nil) ⇒ EndpointConfiguration
constructor
Initializes a new EndpointConfiguration.
Constructor Details
#initialize(properties = nil, prefix = nil) ⇒ EndpointConfiguration
Initializes a new EndpointConfiguration.
The given properties is searched for settings using properties[prefix + ‘.setting_name’] The following settings are searched:
- endpoint
-
This property is searched for endpoint.host, endpoint.scheme and endpoint.port. The found host, scheme and port are used to construct the base URL to the Ingenico ePayments platform.
- connectTimeout
-
The number of seconds before a connection attempt with the Ingenico ePayments platform times out.
- socketTimeout
-
The number of seconds before a timeout occurs when transmitting data to or from the Ingenico ePayments platform.
- maxConnections
-
The number of connections with the Ingenico ePayments platform that are kept alive in the connection pool. These connections will be reused when possible.
- proxy
-
This property is searched for proxy.uri, proxy.username and proxy.password. The found URI, username and password are used for connecting to the Ingenico ePayments platform using a proxy.
- integrator
-
Name of the integrator
- shoppingCartExtension
-
Will be used to initialize a Domain::Metadata::ShoppingCartExtension.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 44 def initialize(properties = nil, prefix = nil) unless properties.nil? @api_endpoint = get_endpoint(properties, prefix) @connect_timeout = properties[prefix + '.connectTimeout'] @socket_timeout = properties[prefix + '.socketTimeout'] @max_connections = get_property(properties, prefix + '.maxConnections', @@DEFAULT_MAX_CONNECTIONS) proxy_uri = properties[prefix + '.proxy.uri'] proxy_user = properties[prefix + '.proxy.username'] proxy_pass = properties[prefix + '.proxy.password'] unless proxy_uri.nil? @proxy_configuration = ProxyConfiguration.new(address: URI(proxy_uri), username: proxy_user, password: proxy_pass) end @integrator = properties[prefix + '.integrator'] @shopping_cart_extension = get_shopping_cart_extension(properties, prefix) end end |
Instance Attribute Details
#api_endpoint ⇒ String
The base URL to the Ingenico ePayments platform.
18 19 20 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 18 def api_endpoint @api_endpoint end |
#connect_timeout ⇒ Integer
The number of seconds before a connection attempt with the Ingenico ePayments platform times out.
18 19 20 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 18 def connect_timeout @connect_timeout end |
#integrator ⇒ String
Name of the integrator
18 19 20 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 18 def integrator @integrator end |
#max_connections ⇒ Integer
The number of connections with the Ingenico ePayments platform that are kept alive in the connection pool. These connections will be reused when possible.
18 19 20 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 18 def max_connections @max_connections end |
#proxy_configuration ⇒ Ingenico::Connect::SDK::ProxyConfiguration
Proxy settings.
18 19 20 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 18 def proxy_configuration @proxy_configuration end |
#shopping_cart_extension ⇒ Ingenico::Connect::SDK::Domain::Metadata::ShoppingCartExtension
Shopping cart-related metadata.
18 19 20 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 18 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 Ingenico ePayments platform.
18 19 20 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 18 def socket_timeout @socket_timeout end |
Class Method Details
.DEFAULT_MAX_CONNECTIONS ⇒ Object
The default number of connections that are kept alive in the connection pool. Used if maxConnections is not present in the properties.
23 24 25 |
# File 'lib/ingenico/connect/sdk/endpoint_configuration.rb', line 23 def self.DEFAULT_MAX_CONNECTIONS @@DEFAULT_MAX_CONNECTIONS end |