Skip to content

Instantly share code, notes, and snippets.

@revathskumar
Created July 16, 2011 10:53
Show Gist options
  • Save revathskumar/1086257 to your computer and use it in GitHub Desktop.
Save revathskumar/1086257 to your computer and use it in GitHub Desktop.
Invoke web service request in ruby
require "rubygems"
require "net/https"
require "uri"
require "json"
uri = URI.parse("http://api.twitter.com/1/statuses/public_timeline.json")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
res = http.request(request)
response = JSON.parse(res.body)
puts response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment