PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/crack.rb

http://github.com/jnunemaker/httparty
Ruby | 19 lines | 15 code | 4 blank | 0 comment | 0 complexity | 9a535fa8f2470d5f9f07f184820c5137 MD5 | raw file
 1require 'rubygems'
 2require 'crack'
 3
 4dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
 5require File.join(dir, 'httparty')
 6require 'pp'
 7
 8class Rep
 9  include HTTParty
10
11  parser(
12    proc do |body, format|
13      Crack::XML.parse(body)
14    end
15  )
16end
17
18pp Rep.get('http://whoismyrepresentative.com/getall_mems.php?zip=46544')
19pp Rep.get('http://whoismyrepresentative.com/getall_mems.php', query: { zip: 46544 })