Module: RateBeer::Configuration
- Included in:
- RateBeer
- Defined in:
- lib/rate_beer/configuration.rb
Constant Summary collapse
- VALID_CONNECTION_KEYS =
[:endpoint, :user_agent].freeze
- VALID_OPTIONS_KEYS =
[:api_key].freeze
- VALID_CONFIG_KEYS =
VALID_OPTIONS_KEYS + VALID_CONNECTION_KEYS
- DEFAULT_API_KEY =
nil- DEFAULT_USER_AGENT =
"RateBeer API Ruby Gem #{RateBeer::VERSION}"- DEFAULT_ENDPOINT =
'http://ratebeer.com/json'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
13 14 15 |
# File 'lib/rate_beer/configuration.rb', line 13 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
21 22 23 |
# File 'lib/rate_beer/configuration.rb', line 21 def configure yield self end |
#options ⇒ Object
17 18 19 |
# File 'lib/rate_beer/configuration.rb', line 17 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
25 26 27 28 29 |
# File 'lib/rate_beer/configuration.rb', line 25 def reset self.api_key = DEFAULT_API_KEY self.user_agent = DEFAULT_USER_AGENT self.endpoint = DEFAULT_ENDPOINT end |