class Elastics::HttpClients::RestClient

Public Instance Methods

request(method, path, data=nil) click to toggle source
# File lib/elastics/http_clients/rest_client.rb, line 5
def request(method, path, data=nil)
  url  = "#{base_uri}#{path}"
  opts = options.merge( :method  => method.to_s.downcase.to_sym,
                        :url     => url,
                        :payload => data )
  response = ::RestClient::Request.new( opts ).execute
  extend_response(response, url)

rescue ::RestClient::ExceptionWithResponse => e
  extend_response(e.response, url)
end

Private Instance Methods

extend_response(response, url) click to toggle source
# File lib/elastics/http_clients/rest_client.rb, line 19
def extend_response(response, url)
  response.extend ResponseExtension
  response.url = url
  response
end