Class: Talkable::Configuration
- Inherits:
-
Object
- Object
- Talkable::Configuration
- Defined in:
- lib/talkable/configuration.rb
Defined Under Namespace
Classes: UnknownOptionError
Constant Summary collapse
- DEFAULT_SERVER =
"https://www.talkable.com".freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#js_integration_library ⇒ Object
Returns the value of attribute js_integration_library.
-
#server ⇒ Object
Returns the value of attribute server.
-
#site_slug ⇒ Object
Returns the value of attribute site_slug.
Instance Method Summary collapse
- #apply(config) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 |
# File 'lib/talkable/configuration.rb', line 13 def initialize self.site_slug = ENV["TALKABLE_SITE_SLUG"] self.api_key = ENV["TALKABLE_API_KEY"] self.server = DEFAULT_SERVER end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/talkable/configuration.rb', line 6 def api_key @api_key end |
#js_integration_library ⇒ Object
Returns the value of attribute js_integration_library.
8 9 10 |
# File 'lib/talkable/configuration.rb', line 8 def js_integration_library @js_integration_library end |
#server ⇒ Object
Returns the value of attribute server.
7 8 9 |
# File 'lib/talkable/configuration.rb', line 7 def server @server end |
#site_slug ⇒ Object
Returns the value of attribute site_slug.
5 6 7 |
# File 'lib/talkable/configuration.rb', line 5 def site_slug @site_slug end |
Instance Method Details
#apply(config) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/talkable/configuration.rb', line 19 def apply(config) config.each do |key, value| if respond_to?("#{key}=") public_send("#{key}=", value) else raise UnknownOptionError.new("There is no `#{key}` option") end end end |