public
Description: Makes http fun! Also, makes consuming restful web services dead easy.
Homepage:
Clone URL: git://github.com/jnunemaker/httparty.git
Click here to lend your support to: httparty and make a donation at www.pledgie.com !
commit  12e312206be444382106ff7d18537aac4cd4df99
tree    4e0b626ec2f58e17f3bd22aa0494aa20ca88f362
parent  35090072152b6495f781aac3859bf3b342469f2c
httparty / examples / rubyurl.rb
100644 14 lines (11 sloc) 0.358 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.join(dir, 'httparty')
require 'pp'
 
class Rubyurl
  include HTTParty
  base_uri 'rubyurl.com'
 
  def self.shorten( website_url )
    post( '/api/links.json', :query => { :link => { :website_url => website_url } } )
  end
end
 
pp Rubyurl.shorten( 'http://istwitterdown.com/')