Sha256: 1f14919e633ce93863ada1fa3a211a1ed83ffc25cc4ea2cac409278876b69260
Contents?: true
Size: 1.18 KB
Versions: 5
Compression:
Stored size: 1.18 KB
Contents
require 'uri' require 'elastic/enterprise-search/version' module Elastic module EnterpriseSearch module Configuration DEFAULT_ENDPOINT = "http://localhost:3002/api/v1/" VALID_OPTIONS_KEYS = [ :access_token, :user_agent, :endpoint ].freeze attr_accessor *VALID_OPTIONS_KEYS def self.extended(base) base.reset end # Reset configuration to default values. def reset self.access_token = nil self.endpoint = DEFAULT_ENDPOINT self.user_agent = nil self end # Yields the Elastic::EnterpriseSearch::Configuration module which can be used to set configuration options. # # @return self def configure yield self self end # Return a hash of the configured options. def options options = {} VALID_OPTIONS_KEYS.each{ |k| options[k] = send(k) } options end # setter for endpoint that ensures it always ends in '/' def endpoint=(endpoint) if endpoint.end_with?('/') @endpoint = endpoint else @endpoint = "#{endpoint}/" end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems