Class: Worldline::Connect::SDK::Client
- Inherits:
-
ApiResource
- Object
- ApiResource
- Worldline::Connect::SDK::Client
- Defined in:
- lib/worldline/connect/sdk/client.rb
Overview
Worldline Global Collect 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
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.
-
#set_body_obfuscator(body_obfuscator) ⇒ Object
Sets the current body obfuscator to use.
-
#set_header_obfuscator(header_obfuscator) ⇒ Object
Sets the current header obfuscator to use.
- #v1 ⇒ Worldline::Connect::SDK::V1::V1Client
-
#with_client_meta_info(client_meta_info) ⇒ Worldline::Connect::SDK::Client
A Client which uses the passed metadata for the X-GCS-ClientMetaInfo header.
Constructor Details
#initialize(communicator, client_meta_info = nil) ⇒ Client
Returns a new instance of Client.
28 29 30 |
# File 'lib/worldline/connect/sdk/client.rb', line 28 def initialize(communicator, = nil) super(communicator: communicator, client_meta_info: ) end |
Instance Method Details
#close ⇒ Object
Releases any system resources associated with this object.
86 87 88 |
# File 'lib/worldline/connect/sdk/client.rb', line 86 def close @communicator.close end |
#close_expired_connections ⇒ Object
Utility method that delegates the call to this client’s communicator.
58 59 60 |
# File 'lib/worldline/connect/sdk/client.rb', line 58 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.
53 54 55 |
# File 'lib/worldline/connect/sdk/client.rb', line 53 def close_idle_connections(idle_time) @communicator.close_idle_connections(idle_time) end |
#disable_logging ⇒ Object
Turns off logging.
81 82 83 |
# File 'lib/worldline/connect/sdk/client.rb', line 81 def disable_logging @communicator.disable_logging end |
#enable_logging(communicator_logger) ⇒ Object
Turns on logging using the given communicator logger.
76 77 78 |
# File 'lib/worldline/connect/sdk/client.rb', line 76 def enable_logging(communicator_logger) @communicator.enable_logging(communicator_logger) end |
#set_body_obfuscator(body_obfuscator) ⇒ Object
Sets the current body obfuscator to use.
64 65 66 |
# File 'lib/worldline/connect/sdk/client.rb', line 64 def set_body_obfuscator(body_obfuscator) @communicator.set_body_obfuscator(body_obfuscator) end |
#set_header_obfuscator(header_obfuscator) ⇒ Object
Sets the current header obfuscator to use.
70 71 72 |
# File 'lib/worldline/connect/sdk/client.rb', line 70 def set_header_obfuscator(header_obfuscator) @communicator.set_header_obfuscator(header_obfuscator) end |
#v1 ⇒ Worldline::Connect::SDK::V1::V1Client
91 92 93 |
# File 'lib/worldline/connect/sdk/client.rb', line 91 def v1 Worldline::Connect::SDK::V1::V1Client.new(self, nil) end |
#with_client_meta_info(client_meta_info) ⇒ Worldline::Connect::SDK::Client
Returns a Client which uses the passed metadata for the X-GCS-ClientMetaInfo header.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/worldline/connect/sdk/client.rb', line 35 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 |