public
Rubygem
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 !
Added to_s when doing Hash#to_param so that numbers don't throw error when then 
get encoded.
jnunemaker (author)
Sat Dec 06 20:54:40 -0800 2008
commit  05c388dc72895cd0719a030269cf9c54966d6f2c
tree    eaf8a70864b276ce5202902840debef3591b94c7
parent  0b5579783ad7865b88337fc50ef72b01fa525bf9
...
1
2
 
3
4
5
6
7
8
9
10
 
 
11
12
13
14
 
...
1
2
3
4
5
6
7
8
 
 
 
9
10
11
12
13
 
14
0
@@ -1,14 +1,14 @@
0
 dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
0
 require File.join(dir, 'httparty')
0
+require 'pp'
0
 
0
 class Rubyurl
0
   include HTTParty
0
   base_uri 'rubyurl.com'
0
 
0
-  def self.shorten(website_url)
0
-    xml = post('/api/links.json', :query => {'link[website_url]' => website_url})
0
-    xml['link'] && xml['link']['permalink']
0
+  def self.shorten( website_url )
0
+    post( '/api/links.json', :query => { :link => { :website_url => website_url } } )
0
   end
0
 end
0
 
0
-puts Rubyurl.shorten( 'http://istwitterdown.com/' ).inspect
0
+pp Rubyurl.shorten( 'http://istwitterdown.com/' )
...
28
29
30
31
32
 
33
...
28
29
30
 
31
32
33
0
@@ -28,4 +28,4 @@ twitter = Twitter.new(config['email'], config['password'])
0
 pp twitter.timeline
0
 # pp twitter.timeline(:friends, :query => {:since_id => 868482746})
0
 # pp twitter.timeline(:friends, :query => 'since_id=868482746')
0
-pp twitter.post('this is a test of 0.2.0')
0
\ No newline at end of file
0
+# pp twitter.post('this is a test of 0.2.0')
0
\ No newline at end of file
...
6
7
8
9
10
 
 
11
...
6
7
8
 
9
10
11
12
0
@@ -6,4 +6,5 @@ class Rep
0
   include HTTParty
0
 end
0
 
0
-puts Rep.get('http://whoismyrepresentative.com/whoismyrep.php?zip=46544').inspect
0
\ No newline at end of file
0
+pp Rep.get('http://whoismyrepresentative.com/whoismyrep.php?zip=46544')
0
+pp Rep.get('http://whoismyrepresentative.com/whoismyrep.php', :query => {:zip => 46544})
0
\ No newline at end of file
...
322
323
324
325
 
326
327
328
...
322
323
324
 
325
326
327
328
0
@@ -322,7 +322,7 @@ class Hash
0
     elsif value.is_a?(Hash)
0
       stack << [key,value]
0
     else
0
-      param << "#{key}=#{URI.encode(value)}&"
0
+      param << "#{key}=#{URI.encode(value.to_s)}&"
0
     end
0
 
0
     stack.each do |parent, hash|

Comments