class EzClient::Client
Constants
- REQUEST_OPTION_KEYS
Attributes
request_options[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/ezclient/client.rb, line 20 def initialize(options = {}) self.request_options = options EzClient::CheckOptions.call(options, REQUEST_OPTION_KEYS) end
Public Instance Methods
perform(*args, **kwargs)
click to toggle source
# File lib/ezclient/client.rb, line 42 def perform(*args, **kwargs) request(*args, **kwargs).perform end
perform!(*args, **kwargs)
click to toggle source
# File lib/ezclient/client.rb, line 46 def perform!(*args, **kwargs) request(*args, **kwargs).perform! end
request(verb, url, **options)
click to toggle source
# File lib/ezclient/client.rb, line 25 def request(verb, url, **options) options = { **request_options, **options } keep_alive_timeout = options.delete(:keep_alive) api_auth = options.delete(:api_auth) if keep_alive_timeout client = persistent_client_registry.for(url, timeout: keep_alive_timeout) else client = HTTP::Client.new end EzClient::Request.new(verb, url, client: client, **options).tap do |request| request.api_auth!(*api_auth) if api_auth end end
Private Instance Methods
persistent_client_registry()
click to toggle source
# File lib/ezclient/client.rb, line 54 def persistent_client_registry @persistent_client_registry ||= EzClient::PersistentClientRegistry.new end