Module: Wunderground::Configuration

Included in:
Wunderground
Defined in:
lib/wunderground/configuration.rb

Constant Summary collapse

VALID_CONNECTION_KEYS =
[:domain, :user_agent, :method].freeze
VALID_OPTIONS_KEYS =
[:api_key, :format].freeze
VALID_CONFIG_KEYS =
VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
DEFAULT_DOMAIN =
"http://api.wunderground.com/".freeze
DEFAULT_USER_AGENT =
"Wunderground Ruby Gem #{Wunderground::VERSION}".freeze
DEFAULT_API_KEY =
"default_api_key"
DEFAULT_METHOD =
:get
DEFAULT_FORMAT =
:json

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

Make sure we have the default values set when we get ‘extended’



18
19
20
# File 'lib/wunderground/configuration.rb', line 18

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



22
23
24
# File 'lib/wunderground/configuration.rb', line 22

def configure
  yield self
end

#resetObject



26
27
28
29
30
31
32
33
# File 'lib/wunderground/configuration.rb', line 26

def reset
  self.domain     = DEFAULT_DOMAIN
  self.method     = DEFAULT_METHOD
  self.user_agent = DEFAULT_USER_AGENT

  self.api_key    = DEFAULT_API_KEY
  self.format     = DEFAULT_FORMAT
end