class Elastic::SiteSearch::Client
API client for the Elastic Site Search API.
Constants
- DEFAULT_TIMEOUT
Public Class Methods
new(options={})
click to toggle source
Create a new Elastic::SiteSearch::Client
client
@param options [Hash] a hash of configuration options that will override what is set on the Elastic::SiteSearch
class. @option options [String] :api_key an API Key to use for this client @option options [String] :platform_access_token a user's access token, will be used instead of API key for authenticating requests @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) @option options [String] :proxy url of proxy to use, ex: “localhost:8888”
will wait while opening a connection before raising a Timeout::Error
# File lib/elastic/site-search/client.rb, line 23 def initialize(options={}) @options = options end
Public Instance Methods
api_key()
click to toggle source
# File lib/elastic/site-search/client.rb, line 27 def api_key @options[:api_key] || Elastic::SiteSearch.api_key end
open_timeout()
click to toggle source
# File lib/elastic/site-search/client.rb, line 39 def open_timeout @options[:open_timeout] || DEFAULT_TIMEOUT end
overall_timeout()
click to toggle source
# File lib/elastic/site-search/client.rb, line 43 def overall_timeout (@options[:overall_timeout] || DEFAULT_TIMEOUT).to_f end
platform_access_token()
click to toggle source
# File lib/elastic/site-search/client.rb, line 31 def platform_access_token @options[:platform_access_token] end
proxy()
click to toggle source
# File lib/elastic/site-search/client.rb, line 35 def proxy @options[:proxy] end
wrap(element)
click to toggle source
# File lib/elastic/site-search/client.rb, line 47 def wrap(element) [element].flatten(1) end