class ThreeScaleToolbox::ThreeScaleClientFactory

Attributes

remote_str[R]
remotes[R]
verbose[R]
verify_ssl[R]

Public Class Methods

get(remotes, remote_str, verify_ssl, verbose = false) click to toggle source
# File lib/3scale_toolbox/3scale_client_factory.rb, line 4
def get(remotes, remote_str, verify_ssl, verbose = false)
  new(remotes, remote_str, verify_ssl, verbose).call
end
new(remotes, remote_str, verify_ssl, verbose) click to toggle source
# File lib/3scale_toolbox/3scale_client_factory.rb, line 11
def initialize(remotes, remote_str, verify_ssl, verbose)
  @remotes = remotes
  @remote_str = remote_str
  @verify_ssl = verify_ssl
  @verbose = verbose
end

Public Instance Methods

call() click to toggle source
# File lib/3scale_toolbox/3scale_client_factory.rb, line 18
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))
  client = ProxyLogger.new(client) if verbose
  RemoteCache.new(client)
end

Private Instance Methods

remote_client(endpoint:, authentication:, verify_ssl:) click to toggle source
# File lib/3scale_toolbox/3scale_client_factory.rb, line 32
def remote_client(endpoint:, authentication:, verify_ssl:)
  ThreeScale::API.new(endpoint: endpoint, provider_key: authentication, verify_ssl: verify_ssl)
end