Class: IActionable::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/iactionable/settings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ Settings

Returns a new instance of Settings.



8
9
10
11
12
13
14
15
16
# File 'lib/iactionable/settings.rb', line 8

def initialize(values)
  @settings = {
    :app_key => values.fetch(:app_key),
    :api_key => values.fetch(:api_key),
    :version => values.fetch(:version)
  }
rescue NoMethodError, KeyError => e
  raise ConfigError.new("IAction::Settings being initialized with invalid arguments")
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



6
7
8
# File 'lib/iactionable/settings.rb', line 6

def settings
  @settings
end

Instance Method Details

#api_keyObject



22
23
24
# File 'lib/iactionable/settings.rb', line 22

def api_key
  @settings.fetch(:api_key)
end

#app_keyObject



18
19
20
# File 'lib/iactionable/settings.rb', line 18

def app_key
  @settings.fetch(:app_key)
end

#versionObject



26
27
28
# File 'lib/iactionable/settings.rb', line 26

def version
  @settings.fetch(:version)
end