luigi-sunlight 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -108,7 +108,6 @@ Lastly, to provide your users with a name search functionality, use @Legislator#
108
108
 
109
109
  h3. District
110
110
 
111
-
112
111
  There's also the @District@ object. @District#get@ takes in either lat/long or an address and does it's best to return the correct Congressional District:
113
112
 
114
113
  <pre><code>
@@ -126,6 +125,46 @@ Finally, two more methods, @District.all_from_zipcode@ and @District.zipcodes_in
126
125
  zipcodes = Sunlight::District.zipcodes_in("NY", "10") # returns array of zip codes as strings ["11201", "11202", "11203",...]
127
126
  </code></pre>
128
127
 
128
+
129
+ h3. Committees
130
+
131
+ Members of Congress sit on all-important @Committees@, the smaller bodies that hold hearings and are first to review legislation.
132
+
133
+ The @Committee@ object has three identifying fields, and an array of subcommittees, which are @Committee@ objects themselves. To get all the committees for a given chamber of Congress:
134
+
135
+ <pre><code>
136
+ committees = Sunlight::Committee.all_for_chamber("Senate") # or "House" or "Joint"
137
+ some_committee = committees.last
138
+ some_committee.name # "Senate Committee on Agriculture, Nutrition, and Forestry"
139
+ some_committee.id # "SSAF"
140
+ some_committee.chamber # "Senate"
141
+
142
+ some_committee.subcommittees.each do |subcommittee|
143
+ # do some stuff...
144
+ end
145
+ </code></pre>
146
+
147
+ The @Committee@ object also keeps a collection of members in that committee, but since that's an API-heavy call, it must be done for each Committee one at a time:
148
+
149
+ <pre><code>
150
+ committees = Sunlight::Committee.all_for_chamber("Senate") # or "House" or "Joint"
151
+ some_committee = committees.last # some_committee.members starts out as nil
152
+ some_committee.load_members # some_committee.members is now populated
153
+ some_committee.members.each do |legislator|
154
+ # do some stuff...
155
+ end
156
+ </code></pre>
157
+
158
+ Coming from the opposite direction, the @Legislator@ object has a method for getting all committees for that particular Legislator, returning an array of @Committee@ objects:
159
+
160
+ <pre><code>
161
+ legislators = Sunlight::Legislator.search_by_name("Ted Kennedy")
162
+ legislator = legislators.first
163
+ legislator.committees.each do |committee|
164
+ # do some stuff...
165
+ end
166
+ </code></pre>
167
+
129
168
  h3. Lobbyists and Filings
130
169
 
131
170
  Moving away from members of Congress, the Sunlight API also exposes data on @Lobbyists@, the organizations and companies they lobby on behalf of, and the @Issues@ they lobby on. Lobbyists must submit filings to the Senate Office of Public Records, and these are represented as @Filings@ in the API.
@@ -16,6 +16,26 @@ module Sunlight
16
16
  instance_variable_set("@#{key}", value) if Legislator.instance_methods.include? key
17
17
  end
18
18
  end
19
+
20
+ # Get the committees the Legislator sits on
21
+ #
22
+ # Returns:
23
+ #
24
+ # An array of Committee objects, each possibly
25
+ # having its own subarray of subcommittees
26
+ def committees
27
+ url = Sunlight::Base.construct_url("committees.allForLegislator", {:bioguide_id => self.bioguide_id})
28
+
29
+ if (result = Sunlight::Base.get_json_data(url))
30
+ committees = []
31
+ result["response"]["committees"].each do |committee|
32
+ committees << Sunlight::Committee.new(committee["committee"])
33
+ end
34
+ else
35
+ nil # appropriate params not found
36
+ end
37
+ committees
38
+ end
19
39
 
20
40
 
21
41
  #
@@ -1,9 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "sunlight"
3
- s.version = "0.9.0"
4
- s.date = "2009-03-15"
3
+ s.version = "1.0.0"
4
+ s.date = "2009-06-10"
5
5
  s.summary = "Library for accessing the Sunlight Labs API."
6
- s.email = "luigi.montanez@gmail.com"
6
+ s.description = "Library for accessing the Sunlight Labs API."
7
+ s.rubyforge_project = "sunlight"
8
+ s.email = "luigi@sunlightfoundation.com"
7
9
  s.homepage = "http://github.com/luigi/sunlight"
8
10
  s.authors = ["Luigi Montanez"]
9
11
  s.files = ['sunlight.gemspec', 'lib/sunlight.rb', 'lib/sunlight/base.rb',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luigi-sunlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luigi Montanez
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-15 00:00:00 -07:00
12
+ date: 2009-06-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,8 +32,8 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.6.1
34
34
  version:
35
- description:
36
- email: luigi.montanez@gmail.com
35
+ description: Library for accessing the Sunlight Labs API.
36
+ email: luigi@sunlightfoundation.com
37
37
  executables: []
38
38
 
39
39
  extensions: []
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version:
73
73
  requirements: []
74
74
 
75
- rubyforge_project:
75
+ rubyforge_project: sunlight
76
76
  rubygems_version: 1.2.0
77
77
  signing_key:
78
78
  specification_version: 2