Class: Hailo::Configuration
- Inherits:
-
Object
- Object
- Hailo::Configuration
- Defined in:
- lib/hailo/configuration.rb
Constant Summary collapse
- AUTH_KEYS =
[:app_user_key, :api_host]
Instance Method Summary collapse
-
#auth_keys ⇒ Object
Returns a hash of api keys and their values.
-
#initialize(config_hash = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #valid? ⇒ Boolean
Constructor Details
#initialize(config_hash = nil) ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 10 11 12 |
# File 'lib/hailo/configuration.rb', line 6 def initialize(config_hash = nil) if config_hash.is_a?(Hash) config_hash.each do |config_name, config_value| self.send("#{config_name}=", config_value) end end end |
Instance Method Details
#auth_keys ⇒ Object
Returns a hash of api keys and their values
15 16 17 18 19 20 |
# File 'lib/hailo/configuration.rb', line 15 def auth_keys AUTH_KEYS.inject({}) do |keys_hash, key| keys_hash[key] = send(key) keys_hash end end |
#valid? ⇒ Boolean
22 23 24 |
# File 'lib/hailo/configuration.rb', line 22 def valid? AUTH_KEYS.none? { |key| send(key).nil? || send(key).empty? } end |