Module: TeamCity::Configuration

Included in:
TeamCity
Defined in:
lib/teamcity/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
  :adapter,
  :endpoint,
  :user_agent,
  :http_user,
  :http_password
].freeze
DEFAULT_ADAPTER =
Faraday.default_adapter
DEFAULT_ENDPOINT =
'http://teamcity:8111/httpAuth/app/rest/'.freeze
DEFAULT_USER_AGENT =
"TeamCity Ruby Client #{TeamCity::VERSION}".freeze
DEFAULT_HTTP_USER =
nil
DEFAULT_HTTP_PASSWORD =
nil
DEFAULT_FORMAT =
:json

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



28
29
30
# File 'lib/teamcity/configuration.rb', line 28

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



32
33
34
# File 'lib/teamcity/configuration.rb', line 32

def configure
  yield self
end

#optionsObject



36
37
38
39
40
# File 'lib/teamcity/configuration.rb', line 36

def options
  VALID_OPTIONS_KEYS.inject({}) do |option, key|
    option.merge!(key => send(key))
  end
end

#resetObject

Reset all configuration options to defaults



43
44
45
46
47
48
49
# File 'lib/teamcity/configuration.rb', line 43

def reset
  self.adapter        = DEFAULT_ADAPTER
  self.endpoint       = DEFAULT_ENDPOINT
  self.user_agent     = DEFAULT_USER_AGENT
  self.http_user      = DEFAULT_HTTP_USER
  self.http_password  = DEFAULT_HTTP_PASSWORD
end