Class: FortyTwo::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/fortytwo/configuration.rb

Constant Summary collapse

AUTH_KEYS =
[:api_key, :api_secret]

Instance Method Summary collapse

Constructor Details

#initialize(config_hash = nil) ⇒ Configuration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
# File 'lib/fortytwo/configuration.rb', line 7

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

#invalid?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/fortytwo/configuration.rb', line 15

def invalid?
  AUTH_KEYS.any? { |key| send(key).nil? || send(key).empty? }
end