module Artifactory::Configurable

A re-usable class containing configuration information for the {Client}. See {Defaults} for a list of default values.

Public Class Methods

keys() click to toggle source

The list of configurable keys.

@return [Array<Symbol>]

# File lib/artifactory/configurable.rb, line 29
def keys
  @keys ||= %i{
    endpoint
    username
    password
    api_key
    proxy_address
    proxy_password
    proxy_port
    proxy_username
    ssl_pem_file
    ssl_verify
    user_agent
    read_timeout
  }
end

Public Instance Methods

configure() { |self| ... } click to toggle source

Set the configuration for this config, using a block.

@example Configure the API endpoint

Artifactory.configure do |config|
  config.endpoint = "http://www.my-artifactory-server.com/artifactory"
end
# File lib/artifactory/configurable.rb, line 62
def configure
  yield self
end
reset!() click to toggle source

Reset all configuration options to their default values.

@example Reset all settings

Artifactory.reset!

@return [self]

# File lib/artifactory/configurable.rb, line 74
def reset!
  Artifactory::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Defaults.options[key])
  end
  self
end
Also aliased as: setup
setup()
Alias for: reset!

Private Instance Methods

options() click to toggle source

The list of configurable keys, as an options hash.

@return [Hash]

# File lib/artifactory/configurable.rb, line 89
def options
  map = Artifactory::Configurable.keys.map do |key|
    [key, instance_variable_get(:"@#{key}")]
  end
  Hash[map]
end