Sha256: 2fb83fb58d6f936807e5707759f6e56257c81339b3ce05bfb2971ae75fe3523c
Contents?: true
Size: 515 Bytes
Versions: 4
Compression:
Stored size: 515 Bytes
Contents
module RedisRing class HttpClient def get(host, port, path, params = {}) Net::HTTP.get(uri(host, port, path, params)) end def post(host, port, path, params = {}) Net::HTTP.post_form(uri(host, port, path, params), {}).body end protected def uri(host, port, path, params) params_str = params.map{|k,v| "#{k}=#{v}"}.join("&") params_str = "?" + params_str unless params_str.empty? URI.parse("http://#{host}:#{port}#{path}#{params_str}") end end end
Version data entries
4 entries across 4 versions & 1 rubygems