Class: Swiftype::Client

Inherits:
Object
  • Object
show all
Includes:
Analytics, Clickthrough, Document, DocumentType, Domain, Engine, Search, User, Request
Defined in:
lib/swiftype/client.rb

Overview

API client for the Swiftype API.

Defined Under Namespace

Modules: Analytics, Clickthrough, Document, DocumentType, Domain, Engine, Search, User

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Clickthrough

#log_clickthrough

Methods included from Domain

#crawl_url, #create_domain, #destroy_domain, #domain, #domains, #recrawl_domain

Methods included from Analytics

#analytics_autoselects, #analytics_clicks, #analytics_searches, #analytics_top_no_result_queries, #analytics_top_queries

Methods included from Document

#async_create_or_update_documents, #create_document, #create_documents, #create_or_update_document, #create_or_update_documents, #create_or_update_documents_verbose, #destroy_document, #destroy_documents, #document, #document_receipts, #documents, #index_documents, #update_document, #update_documents

Methods included from DocumentType

#create_document_type, #destroy_document_type, #document_type, #document_types

Methods included from Engine

#create_engine, #destroy_engine, #engine, #engines

Methods included from Search

#search, #search_document_type, #suggest, #suggest_document_type

Methods included from User

#create_user, #user, #users

Methods included from Request

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

Constructor Details

#initialize(options = {}) ⇒ Client

Create a new Swiftype::Client client

Options Hash (options):

  • :api_key (String)

    an API Key to use for this client

  • :platform_access_token (String)

    a user's access token, will be used instead of API key for authenticating requests

  • :overall_timeout (Numeric)

    overall timeout for requests in seconds

  • :open_timeout (Numeric)

    the number of seconds Net::HTTP will wait while opening a connection before raising a Timeout::Error


24
25
26
# File 'lib/swiftype/client.rb', line 24

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

Class Method Details

.configure(&block) ⇒ Object


10
11
12
13
# File 'lib/swiftype/client.rb', line 10

def self.configure(&block)
  warn "`Swiftype::Easy.configure` has been deprecated. Use `Swiftype.configure` instead."
  Swiftype.configure &block
end

Instance Method Details

#api_keyObject


28
29
30
# File 'lib/swiftype/client.rb', line 28

def api_key
  @options[:api_key] || Swiftype.api_key
end

#open_timeoutObject


36
37
38
# File 'lib/swiftype/client.rb', line 36

def open_timeout
  @options[:open_timeout]
end

#overall_timeoutObject


40
41
42
# File 'lib/swiftype/client.rb', line 40

def overall_timeout
  @options[:overall_timeout].to_f
end

#platform_access_tokenObject


32
33
34
# File 'lib/swiftype/client.rb', line 32

def platform_access_token
  @options[:platform_access_token]
end