hulse 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +15 -6
- data/lib/hulse/senate_vote.rb +12 -5
- data/lib/hulse/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MTlkN2I2N2EyOWIwNTQ4Y2YyZWIwN2JlYWZkYmVmYzE0ZDcxNWU5NA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 15df258b833015587148bb55dc2ac84eed7b0847
|
4
|
+
data.tar.gz: c5c0342fc6cd999ffc09ef37cfeba1ae12c859de
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NWFjMGYzOThiMmY0YmY4NmZjYzljNjkzZGY1MDQwMjQ3MDhjZWM5ZmMxNTBk
|
11
|
-
NWE2NmI2N2U3MGRkMWJiZTlmMWIyMGQ5MzRhYjNjMGZjOGEzYjQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Njk5MWY2MTE2ZGI0OWRkZjU1MWMzNzg2ZjNiMTZmN2FhZGExMzI3MDk2MDI0
|
14
|
-
OWEyM2I2ZDQyYjc3NWZjYTJhZGUwNzY2MzcxNWM0YzBlYTg2NjJhNDAyNTcz
|
15
|
-
ZTVkMGI4MjhiZDE2MTE3MmMzNGJmNmRlOGY3MDU3YzEzNjRhOWY=
|
6
|
+
metadata.gz: 61de40fec032187360350d9392bd57899f2decd9ef8b676fe74893aebb31610e1d10820f79061e477d71c59f2cc6a31b494f040dacdf128d740d7b69fbe57ce2
|
7
|
+
data.tar.gz: 870095110842826ce38ad502fb6ac1d69f34837d7a6dbe5b77235609437f4b0aa4ab1a482d608244bbf00e4a23ee4561eab17b854b705ada8e58280f653a6a4f
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Hulse
|
2
2
|
|
3
|
-
Hulse is a Ruby gem for accessing House and Senate roll call votes from the official sources on [house.gov](http://clerk.house.gov/evs/2013/index.asp) and [senate.gov](http://www.senate.gov/pagelayout/legislative/a_three_sections_with_teasers/votes.htm). It
|
3
|
+
Hulse is a Ruby gem for accessing House and Senate roll call votes from the official sources on [house.gov](http://clerk.house.gov/evs/2013/index.asp) and [senate.gov](http://www.senate.gov/pagelayout/legislative/a_three_sections_with_teasers/votes.htm). It works using Ruby 1.9.3 and 2.0.0.
|
4
4
|
|
5
5
|
Hulse has two classes, `HouseVote` and `SenateVote`, which create Ruby objects using the XML attributes available from roll call vote data (voice votes are not covered by Hulse or available as data from official sources). Hulse makes a few changes, renaming some attributes for clarity and consistency, and collapsing each House vote's date and time into a single datetime attribute. Otherwise it does not alter the original data.
|
6
6
|
|
@@ -27,20 +27,29 @@ Or install it yourself as:
|
|
27
27
|
For both House and Senate votes, pass the year and roll call number into the `find` class method:
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
2.0.0p353 :001 > require 'hulse'
|
31
|
+
2.0.0p353 :002 > include Hulse
|
32
|
+
2.0.0p353 :003 > hv = HouseVote.find(2013, 628)
|
33
|
+
2.0.0p353 :004 > hv.question
|
34
34
|
=> "On Agreeing to the Amendment"
|
35
|
-
|
35
|
+
2.0.0p353 :005 > hv.vote_count
|
36
36
|
=> {:yea_total=>157, :nay_total=>258, :present_total=>0, :not_voting_total=>16}
|
37
37
|
```
|
38
38
|
|
39
39
|
Be aware that in 2012, there were 5 House votes that occurred on Jan. 1, 2013. These are considered "2012" votes by [the Clerk of the House](http://clerk.house.gov/evs/2012/index.asp), so use 2012 as the year for these.
|
40
40
|
|
41
|
+
For Senate votes, you can grab a year's SenateVote objects (with a limited set of attributes) by using the `summary` method:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
2.0.0p353 :006 > senate_2013 = SenateVote.summary(2013)
|
45
|
+
2.0.0p353 :007 > senate_2013.first
|
46
|
+
=> #<Hulse::SenateVote:0x000001017f0d58 @congress=113, @session=1, @year=2013, @vote_number="00291", @vote_date=<Date: 2013-12-20 ((2456647j,0s,0n),+0s,2299161j)>, @issue="PN921", @question="On the Cloture Motion", @vote_result="Agreed to", @vote_count={:yeas=>"59", :nays=>"34"}, @vote_title="Motion to Invoke Cloture on the Nomination of Janet L. Yellen to be Chairman of the Board of Governors of the Federal Reserve System">
|
47
|
+
```
|
48
|
+
|
41
49
|
## Authors
|
42
50
|
|
43
51
|
* [Derek Willis](https://github.com/dwillis)
|
52
|
+
* [Eric Mill](https://github.com/konklone)
|
44
53
|
|
45
54
|
## Contributing
|
46
55
|
|
data/lib/hulse/senate_vote.rb
CHANGED
@@ -2,16 +2,16 @@ module Hulse
|
|
2
2
|
class SenateVote
|
3
3
|
|
4
4
|
attr_reader :congress, :session, :year, :vote_number, :vote_timestamp, :updated_at, :vote_question_text, :vote_document_text,
|
5
|
-
:vote_result_text, :question, :vote_title, :majority_requirement, :vote_result, :document, :amendment, :vote_count, :tie_breaker, :members
|
5
|
+
:vote_result_text, :question, :vote_title, :majority_requirement, :vote_result, :document, :amendment, :vote_count, :tie_breaker, :members,
|
6
|
+
:vote_date, :issue
|
6
7
|
|
7
8
|
def initialize(params={})
|
8
9
|
params.each_pair do |k,v|
|
9
10
|
instance_variable_set("@#{k}", v)
|
10
11
|
end
|
11
12
|
end
|
12
|
-
|
13
|
+
|
13
14
|
def self.find(year, vote)
|
14
|
-
# TODO: need to special-case 2013 votes from 112th congress, 2nd session
|
15
15
|
congress, session = Hulse::Utils.convert_year_to_congress_and_session(year)
|
16
16
|
url = "http://www.senate.gov/legislative/LIS/roll_call_votes/vote#{congress}#{session}/vote_#{congress}_#{session}_#{vote.to_s.rjust(5,"0")}.xml"
|
17
17
|
response = HTTParty.get(url)
|
@@ -43,7 +43,14 @@ module Hulse
|
|
43
43
|
members: members
|
44
44
|
)
|
45
45
|
end
|
46
|
-
|
47
|
-
|
46
|
+
|
47
|
+
def self.summary(year)
|
48
|
+
congress, session = Hulse::Utils.convert_year_to_congress_and_session(year)
|
49
|
+
url = "http://www.senate.gov/legislative/LIS/roll_call_lists/vote_menu_#{congress}_#{session}.xml"
|
50
|
+
response = HTTParty.get(url)
|
51
|
+
votes = response.parsed_response['vote_summary']['votes']['vote']
|
52
|
+
votes.map{|v| self.new(congress: congress, session: session, year: year, vote_number: v['vote_number'], vote_date: Date.strptime(v['vote_date']+"-#{year}", "%d-%b-%Y"), issue: v['issue'],
|
53
|
+
question: v['question'], vote_result: v['result'], vote_count: v['vote_tally'].inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}, vote_title: v['title'])}
|
54
|
+
end
|
48
55
|
end
|
49
56
|
end
|
data/lib/hulse/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hulse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Willis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,42 +28,42 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: httparty
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: oj
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Turns House and Senate votes into Ruby objects for your legislative pleasure.
|
@@ -93,17 +93,17 @@ require_paths:
|
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - '>='
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.2.0
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Hulse is a Ruby gem for accessing House and Senate roll call votes from the
|