Sha256: 34d4b911764ffff53da7c3f462fb3b5eb253b1c19582eaa6d3db31e9475efa4d
Contents?: true
Size: 809 Bytes
Versions: 25
Compression:
Stored size: 809 Bytes
Contents
module Elastics module HttpClients class RestClient < Base 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 def extend_response(response, url) response.extend ResponseExtension response.url = url response end module ResponseExtension attr_accessor :url def status code.to_i end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems