Class: Ingenico::Connect::SDK::Client
- Inherits:
-
ApiResource
- Object
- ApiResource
- Ingenico::Connect::SDK::Client
- Includes:
- Logging::LoggingCapable
- Defined in:
- lib/ingenico/connect/sdk/client.rb
Overview
Ingenico ePayments platform client.
This client and all its child clients are bound to one specific value for the X-GCS-ClientMetaInfo header.
To get a new client with a different header value, use with_client_meta_info.
Thread safe.
Instance Attribute Summary
Attributes inherited from ApiResource
#client_meta_info, #communicator
Class Method Summary collapse
Instance Method Summary collapse
-
#close ⇒ Object
Releases any system resources associated with this object.
-
#close_expired_connections ⇒ Object
Utility method that delegates the call to this client’s communicator.
-
#close_idle_connections(idle_time) ⇒ Object
Utility method that delegates the call to this client’s communicator.
-
#disable_logging ⇒ Object
Turns off logging.
-
#enable_logging(communicator_logger) ⇒ Object
Turns on logging using the given communicator logger.
-
#initialize(communicator, client_meta_info = nil) ⇒ Client
constructor
A new instance of Client.
-
#merchant(merchant_id) ⇒ Ingenico::Connect::SDK::Merchant::MerchantClient
Resource /{merchantId}.
-
#with_client_meta_info(client_meta_info) ⇒ Ingenico::Connect::SDK::Client
A Client which uses the passed meta data for the X-GCS-ClientMetaInfo header.
Constructor Details
#initialize(communicator, client_meta_info = nil) ⇒ Client
Returns a new instance of Client.
32 33 34 |
# File 'lib/ingenico/connect/sdk/client.rb', line 32 def initialize(communicator, =nil) super(communicator, nil, ) end |
Class Method Details
.API_VERSION ⇒ String
26 27 28 |
# File 'lib/ingenico/connect/sdk/client.rb', line 26 def self.API_VERSION 'v1' end |
Instance Method Details
#close ⇒ Object
Releases any system resources associated with this object.
78 79 80 |
# File 'lib/ingenico/connect/sdk/client.rb', line 78 def close @communicator.close end |
#close_expired_connections ⇒ Object
Utility method that delegates the call to this client’s communicator.
62 63 64 |
# File 'lib/ingenico/connect/sdk/client.rb', line 62 def close_expired_connections @communicator.close_expired_connections end |
#close_idle_connections(idle_time) ⇒ Object
Utility method that delegates the call to this client’s communicator.
57 58 59 |
# File 'lib/ingenico/connect/sdk/client.rb', line 57 def close_idle_connections(idle_time) @communicator.close_idle_connections(idle_time) end |
#disable_logging ⇒ Object
Turns off logging.
73 74 75 |
# File 'lib/ingenico/connect/sdk/client.rb', line 73 def disable_logging @communicator.disable_logging end |
#enable_logging(communicator_logger) ⇒ Object
Turns on logging using the given communicator logger.
68 69 70 |
# File 'lib/ingenico/connect/sdk/client.rb', line 68 def enable_logging(communicator_logger) @communicator.enable_logging(communicator_logger) end |
#merchant(merchant_id) ⇒ Ingenico::Connect::SDK::Merchant::MerchantClient
Resource /{merchantId}
85 86 87 88 89 |
# File 'lib/ingenico/connect/sdk/client.rb', line 85 def merchant(merchant_id) Ingenico::Connect::SDK::Merchant::MerchantClient.new(self, { 'merchantId'.freeze => merchant_id, }) end |
#with_client_meta_info(client_meta_info) ⇒ Ingenico::Connect::SDK::Client
Returns a Client which uses the passed meta data for the X-GCS-ClientMetaInfo header.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ingenico/connect/sdk/client.rb', line 39 def () if @client_meta_info.nil? && .nil? self elsif .nil? return Client.new(@communicator, nil) else # Checking to see if this is valid JSON (no JSON parse exceptions) @communicator.marshaller.unmarshal(, DataObject) = Base64.strict_encode64() if @client_meta_info == self else return Client.new(@communicator, ) end end end |