sunlightcongress 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sunlightcongress.rb +13 -10
- metadata +2 -2
data/lib/sunlightcongress.rb
CHANGED
@@ -6,10 +6,6 @@ class SunlightCongress
|
|
6
6
|
@apikey = apikey
|
7
7
|
end
|
8
8
|
|
9
|
-
# Update gem
|
10
|
-
# Push to github
|
11
|
-
# Add to TT
|
12
|
-
|
13
9
|
# Get legislator ID
|
14
10
|
def legislator_id(name)
|
15
11
|
options = {:query => {:apikey => @apikey} }
|
@@ -26,35 +22,40 @@ class SunlightCongress
|
|
26
22
|
end
|
27
23
|
|
28
24
|
# Get all votes by particular congressperson
|
29
|
-
def get_votes(
|
25
|
+
def get_votes(name)
|
26
|
+
id = legislator_id(name)
|
30
27
|
options = {:query => {:apikey => @apikey} }
|
31
28
|
data = HTTParty.get("http://congress.api.sunlightfoundation.com/votes?voter_ids." + id.to_s + "__exists=true", options)["results"]
|
32
29
|
return data.to_json
|
33
30
|
end
|
34
31
|
|
35
32
|
# Get all amendments sponsored by a congressperson
|
36
|
-
def get_amendments(
|
33
|
+
def get_amendments(name)
|
34
|
+
id = legislator_id(name)
|
37
35
|
options = {:query => {:apikey => @apikey} }
|
38
36
|
data = HTTParty.get("http://congress.api.sunlightfoundation.com/amendments?sponsor_type=person&sponsor_id=" + id.to_s , options)["results"]
|
39
37
|
return data.to_json
|
40
38
|
end
|
41
39
|
|
42
40
|
# Get all bills sponsored by a congressperson
|
43
|
-
def get_bills(
|
41
|
+
def get_bills(name)
|
42
|
+
id = legislator_id(name)
|
44
43
|
options = {:query => {:apikey => @apikey} }
|
45
44
|
data = HTTParty.get("http://congress.api.sunlightfoundation.com/bills?sponsor_id=" + id.to_s , options)["results"]
|
46
45
|
return data.to_json
|
47
46
|
end
|
48
47
|
|
49
48
|
# Get all floor updates that mention a congressperson
|
50
|
-
def get_updates(
|
49
|
+
def get_updates(name)
|
50
|
+
id = legislator_id(name)
|
51
51
|
options = {:query => {:apikey => @apikey} }
|
52
52
|
data = HTTParty.get("http://congress.api.sunlightfoundation.com/floor_updates?legislator_ids=" + id.to_s , options)["results"]
|
53
53
|
return data.to_json
|
54
54
|
end
|
55
55
|
|
56
56
|
# Get all committees a congressperson is on
|
57
|
-
def get_committees(
|
57
|
+
def get_committees(name)
|
58
|
+
id = legislator_id(name)
|
58
59
|
options = {:query => {:apikey => @apikey} }
|
59
60
|
data = HTTParty.get("http://congress.api.sunlightfoundation.com/committees?member_ids=" + id.to_s , options)["results"]
|
60
61
|
return data.to_json
|
@@ -81,7 +82,9 @@ class SunlightCongress
|
|
81
82
|
end
|
82
83
|
|
83
84
|
# Get all events (hearings, votes, bills, amendments, floor updates) for a congressperson and output JSON
|
84
|
-
def get_events(
|
85
|
+
def get_events(name)
|
86
|
+
id = legislator_id(name)
|
87
|
+
|
85
88
|
# Get votes
|
86
89
|
votes = JSON.parse(get_votes(id))
|
87
90
|
votearray = Array.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunlightcongress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Access to Sunlight Foundation's congress data.
|
15
15
|
email: shidash@shidash.com
|