Class: Ak4r::Configuration
- Inherits:
-
Object
- Object
- Ak4r::Configuration
- Defined in:
- lib/ak4r/configuration.rb
Constant Summary collapse
- SETTINGS =
[:salt, :header_key, :url_restriction, :url_exclusion]
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #update(settings_hash) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 18 |
# File 'lib/ak4r/configuration.rb', line 13 def initialize @salt = "API_KEY_SALT" @header_key = "HTTP_X_API_KEY" @url_restriction = [/api/] @url_exclusion = [/api\/status/] end |
Instance Method Details
#update(settings_hash) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/ak4r/configuration.rb', line 20 def update(settings_hash) settings_hash.each do |setting, value| unless SETTINGS.include? setting.to_sym raise ArgumentError, "invalid setting: #{setting}" end public_send "#{setting}=", value end end |