Module: TeamCity::Configuration

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

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
  :adapter,
  :endpoint,
  :user_agent,
  :format
].freeze
VALID_FORMATS =
[:json].freeze
DEFAULT_ADAPTER =
Faraday.default_adapter
DEFAULT_ENDPOINT =
'http://teamcity:8111/guestAuth/app/rest/7.0/'.freeze
DEFAULT_USER_AGENT =
"TeamCity Ruby Client #{TeamCity::VERSION}".freeze
DEFAULT_FORMAT =
:json

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



25
26
27
# File 'lib/teamcity/configuration.rb', line 25

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self
end

#optionsObject



33
34
35
36
37
# File 'lib/teamcity/configuration.rb', line 33

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

#resetObject

Reset all configuration options to defaults



40
41
42
43
44
45
# File 'lib/teamcity/configuration.rb', line 40

def reset
  self.adapter        = DEFAULT_ADAPTER
  self.endpoint       = DEFAULT_ENDPOINT
  self.user_agent     = DEFAULT_USER_AGENT
  self.format         = DEFAULT_FORMAT
end