Class: Restool::Service::RemoteClient
- Inherits:
-
Object
- Object
- Restool::Service::RemoteClient
- Defined in:
- lib/restool/service/remote_client.rb
Instance Method Summary collapse
-
#initialize(host, verify_ssl, persistent_connection, timeout) ⇒ RemoteClient
constructor
A new instance of RemoteClient.
- #make_request(path, method, request_params, headers, basic_auth) ⇒ Object
Constructor Details
#initialize(host, verify_ssl, persistent_connection, timeout) ⇒ RemoteClient
Returns a new instance of RemoteClient.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/restool/service/remote_client.rb', line 9 def initialize(host, verify_ssl, persistent_connection, timeout) @connection = if persistent_connection PersistentHTTP.new( pool_size: persistent_connection.pool_size, pool_timeout: timeout, warn_timeout: persistent_connection.warn_timeout, force_retry: persistent_connection.force_retry, url: host, read_timeout: timeout, open_timeout: timeout, verify_mode: verify_ssl?(verify_ssl) ) else uri = URI.parse(host) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = ssl_implied?(uri) http.verify_mode = verify_ssl?(verify_ssl) http.read_timeout = timeout http.open_timeout = timeout # http.set_debug_output($stdout) http end end |
Instance Method Details
#make_request(path, method, request_params, headers, basic_auth) ⇒ Object
33 34 35 36 37 |
# File 'lib/restool/service/remote_client.rb', line 33 def make_request(path, method, request_params, headers, basic_auth) request = RequestUtils.build_request(method, path, request_params, headers, basic_auth) @connection.request(request) end |