Sha256: 270e37216e53d9d57ed8189105447ca002f44f11e972045320e4fe118bb51aa8
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
module ThreeScaleToolbox class ThreeScaleClientFactory class << self def get(remotes, remote_str, verify_ssl, verbose = false, keep_alive = true) new(remotes, remote_str, verify_ssl, verbose, keep_alive).call end end attr_reader :remotes, :remote_str, :verify_ssl, :verbose, :keep_alive def initialize(remotes, remote_str, verify_ssl, verbose, keep_alive) @remotes = remotes @remote_str = remote_str @verify_ssl = verify_ssl @verbose = verbose @keep_alive = keep_alive end def call begin remote = Remotes.from_uri(remote_str) rescue InvalidUrlError remote = remotes.fetch(remote_str) end client = remote_client(**remote.merge(verify_ssl: verify_ssl, keep_alive: keep_alive)) client = ProxyLogger.new(client) if verbose RemoteCache.new(client) end private def remote_client(endpoint:, authentication:, verify_ssl:, keep_alive:) ThreeScale::API.new(endpoint: endpoint, provider_key: authentication, verify_ssl: verify_ssl, keep_alive: keep_alive) end end end
Version data entries
3 entries across 3 versions & 1 rubygems