Class: Elastic::WorkplaceSearch::Client

Inherits:
Object
  • Object
show all
Includes:
ContentSourceDocuments, Permissions, Request
Defined in:
lib/elastic/workplace-search/client.rb,
lib/elastic/workplace-search/client/permissions.rb,
lib/elastic/workplace-search/client/content_source_documents.rb

Overview

API client for the Elastic Workplace Search API.

Defined Under Namespace

Modules: ContentSourceDocuments, Permissions

Constant Summary collapse

DEFAULT_TIMEOUT =
15

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Permissions

#add_user_permissions, #get_user_permissions, #list_all_permissions, #remove_user_permissions, #update_user_permissions

Methods included from ContentSourceDocuments

#destroy_documents, #index_documents

Methods included from Request

#delete, #get, #post, #put, #request

Constructor Details

#initialize(options = {}) ⇒ Client

Create a new Elastic::WorkplaceSearch::Client client

Options Hash (options):

  • :access_token (String)

    an Access Token to use for this client

  • :overall_timeout (Numeric)

    overall timeout for requests in seconds (default: 15s)

  • :open_timeout (Numeric)

    the number of seconds Net::HTTP (default: 15s) will wait while opening a connection before raising a Timeout::Error

  • :proxy (String)

    url of proxy to use, ex: “localhost:8888



29
30
31
# File 'lib/elastic/workplace-search/client.rb', line 29

def initialize(options = {})
  @options = options
end

Class Method Details

.configure(&block) ⇒ Object



17
18
19
# File 'lib/elastic/workplace-search/client.rb', line 17

def self.configure(&block)
  Elastic::WorkplaceSearch.configure &block
end

Instance Method Details

#access_tokenObject



33
34
35
# File 'lib/elastic/workplace-search/client.rb', line 33

def access_token
  @options[:access_token] || Elastic::WorkplaceSearch.access_token
end

#open_timeoutObject



37
38
39
# File 'lib/elastic/workplace-search/client.rb', line 37

def open_timeout
  @options[:open_timeout] || DEFAULT_TIMEOUT
end

#overall_timeoutObject



45
46
47
# File 'lib/elastic/workplace-search/client.rb', line 45

def overall_timeout
  (@options[:overall_timeout] || DEFAULT_TIMEOUT).to_f
end

#proxyObject



41
42
43
# File 'lib/elastic/workplace-search/client.rb', line 41

def proxy
  @options[:proxy]
end