hoverbird-ny-times-congress 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.mkdn +23 -14
  2. data/VERSION.yml +1 -1
  3. metadata +2 -2
@@ -18,20 +18,20 @@ You get a Congress object either by calling Congress.new with the session and ch
18
18
  2007_senate = Congress.new(109, 'senate')
19
19
  2008_house = Congress.new(110, 'house')
20
20
 
21
- Through a Congress object, you can get a list of its representatives as a hash, keyed by congressional Bio ID.
21
+ Through a Congress object, you can get a list of Legislators as a hash, keyed by congressional Bio ID.
22
22
 
23
- senators = Congress.new(111, 'senate').members
23
+ senators = Senate.members
24
24
 
25
25
  Legislator
26
26
  ---------------------
27
+ You could crawl the Hash values to find the bio ID in question, as this is a useful key to use across other open government APIs (notably Sunlight).
27
28
 
28
- $ senators.values.find {|legislator| legislator.name == "Hillary Clinton"}
29
+ $ hrc = senators.values.find {|legislator| legislator.name == "Hillary Clinton"}
30
+ $ bio_id = hrc.bio_id
29
31
 
30
- or
32
+ Legislators come down the wire with a lot of interesting info, such as how often they vote along party lines, what roles they serve in Congress and more. Check out the full set of attributes in the Legislator class.
31
33
 
32
- $ senators['C001041']
33
-
34
- You can also grav a Legislator directly by their Bio ID. This call includes full details on the congressperson's roles, biographical info and more:
34
+ You can also grab a Legislator directly by their Bio ID. This call includes full details on the congressperson's roles, biographical info and more:
35
35
 
36
36
  $ Legislator.find('C001041')
37
37
 
@@ -41,18 +41,23 @@ When accessing a Legislator from a collection of congress members, they include
41
41
  Roll Call Votes
42
42
  ---------------------
43
43
 
44
- To find a vote in any congress, you need to know the session (usually 1 or 2, although rarely congress will go into a 3rd session) and then the ID of the vote:
44
+ To find a Vote in any congress, you need to know the session (usually 1 or 2, although rarely congress will go into a 3rd session) and then the ID of the vote. Recent votes can be found easily through [Thomas](http://thomas.loc.gov/home/rollcallvotes.html). Curious about the details of the "American Recovery and Reinvestment Act"? That's vote number 61:
45
45
 
46
- $ Senate.roll_call_vote(session_number, vote_number)
46
+ $ vote = Senate.roll_call_vote(1, 61)
47
47
 
48
- You can also find recent votes for any given senator:
48
+ This returns a Vote object which also has an array of Positions, showing which legislators voted for and against this bill. Thus it would be simple to collect everyone who voted for and against this bill:
49
+
50
+ $ vote.positions.find_all {|position| position.for?}
51
+ $ vote.positions.find_all {|position| position.against?}
52
+
53
+ You can also find recent votes by any given senator:
49
54
 
50
55
  $ hillary = Legislator.find('C001041')
51
56
  $ hillary.votes
52
57
 
53
58
 
54
59
  Setup
55
- _____________________
60
+ ---------------------
56
61
 
57
62
  Add Github to your rubygems sources (if you haven't already) and then install the gem:
58
63
  $ gem sources -a http://gems.github.com
@@ -62,9 +67,13 @@ You'll also need to [get an API key]:http://developer.nytimes.com/apps/register
62
67
 
63
68
  export NYTIMES_CONGRESS_API_KEY="123456789ETC"
64
69
 
65
- Within your app, you can also set this directly like so:
66
-
67
- NYTimes::Congress::Base.api_key = "123456789ETC"
70
+ Then, just call 'congresh' at the command line, which will open up the Congresh shell.
71
+
72
+ Within an app, you can use the library like so:
73
+
74
+ require 'ny-times-congress'
75
+ include NYTimes::Congress
76
+ Base.api_key = '123456789ETC'
68
77
 
69
78
 
70
79
  Acknowledgements
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 2
4
- :patch: 0
4
+ :patch: 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoverbird-ny-times-congress
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Ewing
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-17 00:00:00 -08:00
12
+ date: 2009-02-20 00:00:00 -08:00
13
13
  default_executable: congresh
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency