Module: Artifactory::Configurable

Included in:
Artifactory, Client
Defined in:
lib/artifactory/configurable.rb

Overview

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.keysArray<Symbol>

The list of configurable keys.

Returns:

  • (Array<Symbol>)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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

Instance Method Details

#configure {|_self| ... } ⇒ Object

Set the configuration for this config, using a block.

Examples:

Configure the API endpoint

Artifactory.configure do |config|
  config.endpoint = "http://www.my-artifactory-server.com/artifactory"
end

Yields:

  • (_self)

Yield Parameters:



62
63
64
# File 'lib/artifactory/configurable.rb', line 62

def configure
  yield self
end

#reset!self Also known as: setup

Reset all configuration options to their default values.

Examples:

Reset all settings

Artifactory.reset!

Returns:

  • (self)


74
75
76
77
78
79
# 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