class UmbrellioUtils::HTTPClient

Public Instance Methods

perform(*args, **kwargs) click to toggle source
# File lib/umbrellio_utils/http_client.rb, line 9
def perform(*args, **kwargs)
  client.perform(*args, **kwargs)
end
perform!(*args, **kwargs) click to toggle source
# File lib/umbrellio_utils/http_client.rb, line 13
def perform!(*args, **kwargs)
  client.perform!(*args, **kwargs)
end
request(*args, **kwargs) click to toggle source
# File lib/umbrellio_utils/http_client.rb, line 17
def request(*args, **kwargs)
  client.request(*args, **kwargs)
end

Private Instance Methods

client() click to toggle source
# File lib/umbrellio_utils/http_client.rb, line 23
def client
  Thread.current[UmbrellioUtils.config.http_client_name] ||= EzClient.new(**ezclient_options)
end
ezclient_options() click to toggle source
# File lib/umbrellio_utils/http_client.rb, line 27
def ezclient_options
  { keep_alive: 30, on_retry: method(:on_retry), timeout: 15 }
end
log!(message) click to toggle source
# File lib/umbrellio_utils/http_client.rb, line 35
def log!(message)
  Rails.logger.info "[httpclient] #{message}"
end
on_retry(_request, error, _metadata) click to toggle source
# File lib/umbrellio_utils/http_client.rb, line 31
def on_retry(_request, error, _metadata)
  log!("Retrying on error: #{error.class}: #{error.message}")
end