Permalink
Browse files

Added crack example.

  • Loading branch information...
1 parent c1bcd31 commit 2cb9a4e8567e7f584ca0c1c997ed12471f5fd928 @jnunemaker committed Oct 5, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 examples/crack.rb
View
@@ -0,0 +1,19 @@
+require 'rubygems'
+require 'crack'
+
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+
+class Rep
+ include HTTParty
+
+ parser(
+ Proc.new do |body, format|
+ Crack::XML.parse(body)
+ end
+ )
+end
+
+pp Rep.get('http://whoismyrepresentative.com/whoismyrep.php?zip=46544')
+pp Rep.get('http://whoismyrepresentative.com/whoismyrep.php', :query => {:zip => 46544})

0 comments on commit 2cb9a4e

Please sign in to comment.