lib/jkl/rest_client.rb in jakal-0.1.1 vs lib/jkl/rest_client.rb in jakal-0.1.2

- old
+ new

@@ -17,12 +17,12 @@ end end def get_from(uri) begin - res = Net::HTTP.get_response(URI.parse(uri)) - res.body + response = Net::HTTP.get_response(URI.parse(uri)) + response.body rescue URI::InvalidURIError => e puts("WARN: Invalid URI: #{e}") rescue SocketError => e puts("WARN: Could not connect: #{e}") rescue Errno::ECONNREFUSED => e @@ -30,9 +30,13 @@ end end def get_xml_from(uri) Hpricot.XML get_from uri + end + + def document_from(text) + Hpricot(text) end end end