hoverbird / ny-times-congress
- Source
- Commits
- Network (0)
- Issues (2)
- Downloads (7)
- Wiki (1)
- Graphs
-
Branch:
lazy_load_legislator
NY Times Congress
A Ruby wrapper for the New York Times Congress API.
The NY Times has graciously been scraping the web for data related to the United States Congress! This is a Ruby library and command-shell intended to make it even easier to get at that data and turn it into useful information.
Introdushing Congresh
The Congress Shell (congresh for short/cute) is a simple interactive prompt for interacting with the API. It provides a few conveniences to make it easy to get at a current Congress:
>> this_years_senate = Senate => #<NYTimes::Congress::Congress:0x12c3d68 @chamber=:senate, @number=111>
>> my_house_of_reps = House => #<NYTimes::Congress::Congress:0x12c3cc8 @chamber=:house, @number=111>
Or access any other Congress by number and chamber like so:
>> 2008_senate = Congress.new(110, :senate) >> 2007_house = Congress.new(109, :house)
Through a congress, you can get a list of its representatives as a hash, keyed by congressional bio ID
representatives = 2007_house.members senators = Senate.members
Legislator.find 'C000286'
The aim of this gem is to provide a simple interface for inquiry into the United States Congress. The NY Times gathers information on our legislator's party affiliations, congressional roles, voting positions and biographical data. By packaging these diverse API calls into an object graph, I hope to make it easier to turn this raw information into real insight on our elected representatives.
Congress.new senators = Congress.new(111, 'senate').members
Roll Call Votes house = Congress.new(111, 'house') votes = house.roll_call_vote(1, 14)
Legislator
hillary = senators.values.find {|legislator| legislator.name == "Hillary Clinton"} hillary = senators['C001041']
Legislator.find('C001041')
Acknowledgements
All information made available through this software is generously gathered and hosted by the New York Times (read Terms of Use below). Inspiration and code was borrowed from the excellent nytimes-movies gem written by Jacob Harris.
Terms of Use
All information made available through this software is generously organized and hosted by the New York Times and is subject to copyright. By obtaining an API key throught their Developer program and accessing this data you are agreeing to abide by certain rules and restrictions. These are available at the URLs below and you should read them before proceeding:
http://developer.nytimes.com/attribution http://developer.nytimes.com/Api_terms_of_use
License
Copyright (c) 2009 Patrick Ewing. patrick.henry.ewing@gmail.com Made available under the MIT License (read COPYING file for details).

