Class: Ingenico::Direct::SDK::EndpointConfiguration
- Inherits:
-
Object
- Object
- Ingenico::Direct::SDK::EndpointConfiguration
- Defined in:
- lib/ingenico/direct/sdk/endpoint_configuration.rb
Overview
Base class for configuration classes in the SDK.
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_CONNECT_TIMEOUT =
10
- DEFAULT_SOCKET_TIMEOUT =
10
- 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::Direct::SDK::ProxyConfiguration
Proxy settings.
-
#shopping_cart_extension ⇒ Ingenico::Direct::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 Ingenico ePayments platform.
Class Method Summary collapse
-
.default_connect_timeout ⇒ Object
The default number of seconds before a connection attempt with the Ingenico ePayments platform times out.
-
.default_max_connections ⇒ Object
The default number of connections that are kept alive in the connection pool.
-
.default_socket_timeout ⇒ Object
The default number of seconds before a timeout occurs when transmitting data to or from the Ingenico ePayments platform.
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::ShoppingCartExtension.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 54 def initialize(properties = nil, prefix = nil) return unless properties @api_endpoint = get_endpoint(properties, prefix) @connect_timeout = get_property(properties, "#{prefix}.connectTimeout", DEFAULT_CONNECT_TIMEOUT) @socket_timeout = get_property(properties, "#{prefix}.socketTimeout", DEFAULT_SOCKET_TIMEOUT) @max_connections = get_property(properties, "#{prefix}.maxConnections", DEFAULT_MAX_CONNECTIONS) proxy_uri = properties["#{prefix}.proxy.uri"] if proxy_uri proxy_user = properties["#{prefix}.proxy.username"] proxy_pass = properties["#{prefix}.proxy.password"] @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 |
Instance Attribute Details
#api_endpoint ⇒ String
The base URL to the Ingenico ePayments platform.
15 16 17 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 15 def api_endpoint @api_endpoint end |
#connect_timeout ⇒ Integer
The number of seconds before a connection attempt with the Ingenico ePayments platform times out.
15 16 17 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 15 def connect_timeout @connect_timeout end |
#integrator ⇒ String
Name of the integrator
15 16 17 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 15 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.
15 16 17 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 15 def max_connections @max_connections end |
#proxy_configuration ⇒ Ingenico::Direct::SDK::ProxyConfiguration
Proxy settings.
15 16 17 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 15 def proxy_configuration @proxy_configuration end |
#shopping_cart_extension ⇒ Ingenico::Direct::SDK::Domain::ShoppingCartExtension
Shopping cart-related metadata.
15 16 17 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 15 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.
15 16 17 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 15 def socket_timeout @socket_timeout end |
Class Method Details
.default_connect_timeout ⇒ Object
The default number of seconds before a connection attempt with the Ingenico ePayments platform times out. Used if connectTimeout is not present in the properties.
22 23 24 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 22 def self.default_connect_timeout DEFAULT_CONNECT_TIMEOUT end |
.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.
34 35 36 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 34 def self.default_max_connections DEFAULT_MAX_CONNECTIONS end |
.default_socket_timeout ⇒ Object
The default number of seconds before a timeout occurs when transmitting data to or from the Ingenico ePayments platform. Used if socketTimeout is not present in the properties.
28 29 30 |
# File 'lib/ingenico/direct/sdk/endpoint_configuration.rb', line 28 def self.default_socket_timeout DEFAULT_SOCKET_TIMEOUT end |