mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Added crack example.
This commit is contained in:
parent
c1bcd310a4
commit
2cb9a4e856
1 changed files with 19 additions and 0 deletions
19
examples/crack.rb
Normal file
19
examples/crack.rb
Normal file
|
@ -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})
|
Loading…
Add table
Reference in a new issue