module Elastic::EnterpriseSearch::Configuration

Configuratin module

Constants

VALID_OPTIONS_KEYS

TODO: Endpoint for EE DEFAULT_ENDPOINT = 'localhost:3002/api/ws/v1/'

Public Class Methods

extended(base) click to toggle source
# File lib/elastic/enterprise-search/configuration.rb, line 34
def self.extended(base)
  base.reset
end

Public Instance Methods

configure() { |self| ... } click to toggle source

Yields the Elastic::WorkplaceSearch::Configuration module which can be used to set configuration options.

@return self

# File lib/elastic/enterprise-search/configuration.rb, line 48
def configure
  yield self
  self
end
endpoint=(endpoint) click to toggle source

setter for endpoint that ensures it always ends in '/'

# File lib/elastic/enterprise-search/configuration.rb, line 61
def endpoint=(endpoint)
  @endpoint = if endpoint.end_with?('/')
                endpoint
              else
                "#{endpoint}/"
              end
end
options() click to toggle source

Return a hash of the configured options.

# File lib/elastic/enterprise-search/configuration.rb, line 54
def options
  options = {}
  VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }
  options
end
reset() click to toggle source

Reset configuration to default values.

# File lib/elastic/enterprise-search/configuration.rb, line 39
def reset
  self.access_token = nil
  self.endpoint = DEFAULT_ENDPOINT
  self
end