jnunemaker / httparty

Makes http fun! Also, makes consuming restful web services dead easy.

This URL has Read+Write access

jnunemaker (author)
Thu Apr 30 04:58:49 -0700 2009
commit  8da360fb4dbc54041a0e65e5b78a83ad408b7db4
tree    56ef81051f6d603cc4f74db52b10eb6ed6473c69
parent  3ad80611e98f7a795174c41e6700ec61bafb84da
httparty / examples / basic.rb
100644 12 lines (9 sloc) 0.395 kb
1
2
3
4
5
6
7
8
9
10
11
12
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.join(dir, 'httparty')
require 'pp'
 
# You can also use post, put, delete in the same fashion
response = HTTParty.get('http://twitter.com/statuses/public_timeline.json')
puts response.body, response.code, response.message, response.headers.inspect
 
response.each do |item|
  puts item['user']['screen_name']
end