class Elastic::WorkplaceSearch::Client

API client for the Elastic Workplace Search API.

Constants

DEFAULT_TIMEOUT

Public Class Methods

configure(&block) click to toggle source
# File lib/elastic/workplace-search/client.rb, line 17
def self.configure(&block)
  Elastic::WorkplaceSearch.configure &block
end
new(options = {}) click to toggle source

Create a new Elastic::WorkplaceSearch::Client client

@param options [Hash] a hash of configuration options that will override what is set on the Elastic::WorkplaceSearch class. @option options [String] :access_token an Access Token to use for this client @option options [Numeric] :overall_timeout overall timeout for requests in seconds (default: 15s) @option options [Numeric] :open_timeout the number of seconds Net::HTTP (default: 15s)

will wait while opening a connection before raising a Timeout::Error

@option options [String] :proxy url of proxy to use, ex: “localhost:8888

# File lib/elastic/workplace-search/client.rb, line 29
def initialize(options = {})
  @options = options
end

Public Instance Methods

access_token() click to toggle source
# File lib/elastic/workplace-search/client.rb, line 33
def access_token
  @options[:access_token] || Elastic::WorkplaceSearch.access_token
end
open_timeout() click to toggle source
# File lib/elastic/workplace-search/client.rb, line 37
def open_timeout
  @options[:open_timeout] || DEFAULT_TIMEOUT
end
overall_timeout() click to toggle source
# File lib/elastic/workplace-search/client.rb, line 45
def overall_timeout
  (@options[:overall_timeout] || DEFAULT_TIMEOUT).to_f
end
proxy() click to toggle source
# File lib/elastic/workplace-search/client.rb, line 41
def proxy
  @options[:proxy]
end