Class: Octo::Search::Client

Inherits:
Object
  • Object
show all
Includes:
Elasticsearch::API
Defined in:
lib/octocore/search/client.rb

Constant Summary collapse

CONNECTION =
::Faraday::Connection.new(url: Octo.get_config(:search)[:server])

Instance Method Summary collapse

Instance Method Details

#perform_request(method, path, params, body) ⇒ Object

Low level method for performing a request to Elastic Search cluster

Parameters:

  • method (String)

    The method ex: get, put, post, etc..

  • path (String)

    The path of the request

  • params (Hash)

    The params of the request

  • body (String)

    The body of the request



21
22
23
24
25
26
27
28
29
# File 'lib/octocore/search/client.rb', line 21

def perform_request(method, path, params, body)
  Octo.logger.debug "--> #{method.upcase} #{path} #{params} #{body}"

  CONNECTION.run_request \
    method.downcase.to_sym,
    path,
    ( body ? MultiJson.dump(body): nil ),
    {'Content-Type' => 'application/json'}
end