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
- DEFAULT_TIMEOUT =
5
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.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#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.
- #reset ⇒ Object
- #timeout=(sec) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
16 17 18 |
# File 'lib/talkable/configuration.rb', line 16 def initialize apply(default_configuration) end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/talkable/configuration.rb', line 7 def api_key @api_key end |
#js_integration_library ⇒ Object
Returns the value of attribute js_integration_library.
11 12 13 |
# File 'lib/talkable/configuration.rb', line 11 def js_integration_library @js_integration_library end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
10 11 12 |
# File 'lib/talkable/configuration.rb', line 10 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
9 10 11 |
# File 'lib/talkable/configuration.rb', line 9 def read_timeout @read_timeout end |
#server ⇒ Object
Returns the value of attribute server.
8 9 10 |
# File 'lib/talkable/configuration.rb', line 8 def server @server end |
#site_slug ⇒ Object
Returns the value of attribute site_slug.
6 7 8 |
# File 'lib/talkable/configuration.rb', line 6 def site_slug @site_slug end |
Instance Method Details
#apply(config) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/talkable/configuration.rb', line 20 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 |
#reset ⇒ Object
34 35 36 |
# File 'lib/talkable/configuration.rb', line 34 def reset apply(default_configuration) end |
#timeout=(sec) ⇒ Object
38 39 40 |
# File 'lib/talkable/configuration.rb', line 38 def timeout=(sec) apply(read_timeout: sec, open_timeout: sec) end |