Module: IndexTank

Defined in:
lib/indextank.rb,
lib/indextank/index.rb,
lib/indextank/client.rb,
lib/indextank/document.rb,
lib/indextank/function.rb,
lib/indextank/exceptions.rb

Defined Under Namespace

Classes: Client, ClientResponseMiddleware, Document, DocumentResponseMiddleware, Function, Index, IndexAlreadyExists, IndexInitializing, InvalidApiKey, InvalidArgument, InvalidQuery, MissingFunctionDefinition, NonExistentIndex, TooManyIndexes, UnexpectedHTTPException

Constant Summary collapse

VERSION =
"1.0.13"

Class Method Summary collapse

Class Method Details

.setup_connection(url) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/indextank.rb', line 10

def self.setup_connection(url)
  @conn = Faraday::Connection.new(:url => url) do |builder|
    builder.use FaradayMiddleware::ParseJson
    yield builder if block_given?
    builder.adapter Faraday.default_adapter
  end
  @uri = URI.parse(url)
  @conn.basic_auth @uri.user,@uri.password
  @conn.headers['User-Agent'] = "IndexTank-Ruby/#{VERSION}"
  @conn
end