Module: Elastic::EnterpriseSearch::Configuration
- Defined in:
- lib/elastic/enterprise-search/configuration.rb
Overview
Configuratin module
Constant Summary collapse
- VALID_OPTIONS_KEYS =
TODO: Endpoint for EE DEFAULT_ENDPOINT = ‘localhost:3002/api/ws/v1/’
[:access_token, :endpoint].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Yields the Elastic::WorkplaceSearch::Configuration module which can be used to set configuration options.
-
#endpoint=(endpoint) ⇒ Object
setter for endpoint that ensures it always ends in ‘/’.
-
#options ⇒ Object
Return a hash of the configured options.
-
#reset ⇒ Object
Reset configuration to default values.
Class Method Details
.extended(base) ⇒ Object
34 35 36 |
# File 'lib/elastic/enterprise-search/configuration.rb', line 34 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Yields the Elastic::WorkplaceSearch::Configuration module which can be used to set configuration options.
48 49 50 51 |
# File 'lib/elastic/enterprise-search/configuration.rb', line 48 def configure yield self self end |
#endpoint=(endpoint) ⇒ Object
setter for endpoint that ensures it always ends in ‘/’
61 62 63 64 65 66 67 |
# File 'lib/elastic/enterprise-search/configuration.rb', line 61 def endpoint=(endpoint) @endpoint = if endpoint.end_with?('/') endpoint else "#{endpoint}/" end end |
#options ⇒ Object
Return a hash of the configured options.
54 55 56 57 58 |
# File 'lib/elastic/enterprise-search/configuration.rb', line 54 def = {} VALID_OPTIONS_KEYS.each { |k| [k] = send(k) } end |
#reset ⇒ Object
Reset configuration to default values.
39 40 41 42 43 |
# File 'lib/elastic/enterprise-search/configuration.rb', line 39 def reset self.access_token = nil self.endpoint = DEFAULT_ENDPOINT self end |