Module: Connexionz::Configuration

Included in:
Connexionz
Defined in:
lib/connexionz/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
:adapter,
:endpoint,
:format,
:proxy,
:user_agent].freeze
VALID_FORMATS =
[
:xml].freeze
DEFAULT_ADAPTER =

Faraday.default_adapter

:patron
DEFAULT_ENDPOINT =
nil
DEFAULT_FORMAT =
:xml
DEFAULT_PROXY =
nil
DEFAULT_USER_AGENT =
"Connexionz Ruby Gem #{Connexionz::VERSION}".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



24
25
26
# File 'lib/connexionz/configuration.rb', line 24

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self
end

#optionsObject



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

def options
  VALID_OPTIONS_KEYS.inject({}){|o,k| o.merge!(k => send(k)) }
end

#resetObject



36
37
38
39
40
41
42
# File 'lib/connexionz/configuration.rb', line 36

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