require 'net/http' def wbs_request(method, uri_string, data={}) uri = URI.parse(uri_string) uri.path = "/" if uri.path.empty? http = Net::HTTP.new(uri.host) case method.to_s.downcase.to_sym when :get query_string = data.to_a.map{|(k, v)| "#{k}=#{v}"}.join("&") return http.get(uri.path + "?" + query_string).body when :post return http.post(uri.path, data).body when :put, :delete, :head raise NotImp