background preloader

Ruby

Facebook Twitter

Igrigorik/em-http-request. Igrigorik/PubSubHubbub. Igrigorik/em-http-request. Net::HTTP Cheat Sheet. By Peter Cooper / January 16, 2010 Norwegian Rubyist August Lilleaas has been busy putting together a ton of examples of using the Net::HTTP Ruby library that comes with most Ruby distributions. I asked him if it'd be okay to put some of them directly on Ruby Inside for reference purposes and he said "No problem! " It's worth noting that Net::HTTP has been superseded in many areas by libraries like John Nunemaker's HTTParty and Paul DIx's high performance Typhoeus, but as part of the standard library, Net::HTTP is still a popular option though it doesn't have the easiest API to remember.

Here's a selection of August's examples for some of the most common operations. Want to see all of the examples and follow any updates made to them? Standard HTTP Request require "net/http"require "uri" uri = URI.parse(" response = Net::HTTP.get_response(uri) Net::HTTP.get_print(uri) http = Net::HTTP.new(uri.host, uri.port)response = http.request(Net::HTTP::Get.new(uri.request_uri)) How do I install ruby 2.0.0 correctly on Ubuntu 12.04. Ruby Programming Language. Pry - an IRB alternative and runtime developer console.