Skip to content

Instantly share code, notes, and snippets.

@amit
Created May 15, 2009 19:50
Show Gist options
  • Save amit/112402 to your computer and use it in GitHub Desktop.
Save amit/112402 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'mash'
require 'httparty'
class CharityNavigator
include HTTParty
format :xml
base_uri "www.charitynavigator.org/feeds/search4"
def initialize(appid)
self.class.default_params :appid=>appid
end
def find(params={})
Mash.new(self.class.get("/?", :query=>params))
end
def method_missing(key)
self[key.to_s] || super
end
end
if __FILE__ == $0
puts "Enter appid"
appid=gets
c= CharityNavigator.new appid
r= c.find :state=>13, :rating=>4, :letter=>"a"
r.resultset.charity.each{|f| puts f.charity_name}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment