Sha256: d2a31449ecb961d8a7e27160febd8a7315bea10f6c0b533ea5db033ac321f3c0
Contents?: true
Size: 467 Bytes
Versions: 12
Compression:
Stored size: 467 Bytes
Contents
require 'rubygems' require 'httparty' class Mcll4r include HTTParty base_uri "http://congress.mcommons.com" format :xml def district_lookup(lat, lng) filter_for_errors self.class.get("/districts/lookup.xml", :query=>{:lat=>lat, :lng=>lng}) end private def filter_for_errors(hash) if hash['response']['error'] raise DistrictNotFound.new(hash['response']['error']) end hash end end class DistrictNotFound < Exception; end
Version data entries
12 entries across 12 versions & 3 rubygems