congress 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +6 -4
- data/Gemfile +14 -0
- data/LICENSE.md +1 -1
- data/README.md +82 -66
- data/Rakefile +0 -2
- data/congress.gemspec +5 -12
- data/lib/congress/client.rb +78 -28
- data/lib/congress/connection.rb +1 -1
- data/lib/congress/version.rb +1 -1
- data/spec/congress/client_spec.rb +138 -59
- data/spec/fixtures/bills.json +1 -1
- data/spec/fixtures/bills_search.json +1 -0
- data/spec/fixtures/committees.json +1 -0
- data/spec/fixtures/districts_locate.json +1 -0
- data/spec/fixtures/floor_updates.json +1 -1
- data/spec/fixtures/hearings.json +1 -0
- data/spec/fixtures/legislators.json +1 -0
- data/spec/fixtures/legislators_locate.json +1 -0
- data/spec/fixtures/upcoming_bills.json +1 -0
- data/spec/fixtures/votes.json +1 -1
- data/spec/helper.rb +6 -6
- metadata +47 -93
- data/spec/fixtures/amendments.json +0 -1
- data/spec/fixtures/committee_hearings.json +0 -1
- data/spec/fixtures/documents.json +0 -1
- data/spec/fixtures/videos.json +0 -1
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,7 +1,21 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
+
gem 'rake'
|
4
|
+
|
3
5
|
platforms :jruby do
|
4
6
|
gem 'jruby-openssl', '~> 0.7'
|
5
7
|
end
|
6
8
|
|
9
|
+
group :development do
|
10
|
+
gem 'json', :platforms => :ruby_18
|
11
|
+
gem 'kramdown'
|
12
|
+
gem 'simplecov'
|
13
|
+
gem 'yard'
|
14
|
+
end
|
15
|
+
|
16
|
+
group :test do
|
17
|
+
gem 'rspec'
|
18
|
+
gem 'webmock'
|
19
|
+
end
|
20
|
+
|
7
21
|
gemspec
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -1,49 +1,60 @@
|
|
1
1
|
# Ruby wrapper for the Real-Time Congress API
|
2
|
+
|
3
|
+
[][gem]
|
4
|
+
[][travis]
|
5
|
+
[][gemnasium]
|
6
|
+
[][codeclimate]
|
7
|
+
[gem]: https://rubygems.org/gems/congress
|
8
|
+
[travis]: http://travis-ci.org/codeforamerica/congress
|
9
|
+
[gemnasium]: https://gemnasium.com/codeforamerica/congress
|
10
|
+
[codeclimate]: https://codeclimate.com/github/codeforamerica/congress
|
11
|
+
|
2
12
|
The Real-Time Congress (RTC) API is a RESTful API over the artifacts of
|
3
13
|
Congress, in as close to real-time as possible.
|
4
14
|
|
5
|
-
##
|
15
|
+
## Installation
|
6
16
|
gem install congress
|
7
17
|
|
8
|
-
##
|
9
|
-
[http://rdoc.info/gems/congress]
|
18
|
+
## Documentation
|
19
|
+
[http://rdoc.info/gems/congress][documentation]
|
20
|
+
[documentation]: http://rdoc.info/gems/congress
|
10
21
|
|
11
|
-
##
|
12
|
-
|
22
|
+
## Usage Examples
|
23
|
+
```ruby
|
24
|
+
require 'rubygems'
|
25
|
+
require 'congress'
|
13
26
|
|
14
|
-
|
15
|
-
|
16
|
-
|
27
|
+
# An API key is required
|
28
|
+
# You can obtain one from http://services.sunlightlabs.com/accounts/register/
|
29
|
+
Congress.key = YOUR_RTC_API_KEY
|
17
30
|
|
18
|
-
|
19
|
-
|
20
|
-
Congress.key = YOUR_RTC_API_KEY
|
31
|
+
# Fetch bills introduced bills and resolutions in Congress
|
32
|
+
puts Congress.bills
|
21
33
|
|
22
|
-
|
23
|
-
|
34
|
+
# Fetch votes taken in Congress
|
35
|
+
puts Congress.votes
|
24
36
|
|
25
|
-
|
26
|
-
|
37
|
+
# Fetch amendments to bills and resolutions offered in Congress
|
38
|
+
puts Congress.amendments
|
27
39
|
|
28
|
-
|
29
|
-
|
40
|
+
# Fetch videos from the U.S. House of Representatives and from the White House
|
41
|
+
puts Congress.videos
|
30
42
|
|
31
|
-
|
32
|
-
|
43
|
+
# Fetch updates from the floor of each chamber of Congress
|
44
|
+
puts Congress.floor_updates
|
33
45
|
|
34
|
-
|
35
|
-
|
46
|
+
# Fetch upcoming scheduled committee hearings in the House and Senate
|
47
|
+
puts Congress.committee_hearings
|
36
48
|
|
37
|
-
|
38
|
-
|
49
|
+
# Fetch links to various kinds of documents produced by agencies within Congress
|
50
|
+
puts Congress.documents
|
51
|
+
```
|
39
52
|
|
40
|
-
|
41
|
-
|
53
|
+
## Contributing
|
54
|
+
In the spirit of [free software][free-sw], **everyone** is encouraged to help improve
|
55
|
+
this project.
|
42
56
|
|
43
|
-
|
44
|
-
In the spirit of [free
|
45
|
-
software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is
|
46
|
-
encouraged to help improve this project.
|
57
|
+
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
|
47
58
|
|
48
59
|
Here are some ways *you* can contribute:
|
49
60
|
|
@@ -55,45 +66,51 @@ Here are some ways *you* can contribute:
|
|
55
66
|
* by writing code (**no patch is too small**: fix typos, add comments, clean up
|
56
67
|
inconsistent whitespace)
|
57
68
|
* by refactoring code
|
58
|
-
* by
|
69
|
+
* by fixing [issues][]
|
59
70
|
* by reviewing patches
|
60
71
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
details that may be necessary to reproduce
|
68
|
-
|
69
|
-
request with failing specs.
|
70
|
-
|
71
|
-
##
|
72
|
-
1. Fork the
|
73
|
-
2. Create a topic branch.
|
74
|
-
3.
|
75
|
-
4.
|
76
|
-
5.
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
72
|
+
[issues]: https://github.com/codeforamerica/congress/issues
|
73
|
+
|
74
|
+
## Submitting an Issue
|
75
|
+
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
76
|
+
submitting a bug report or feature request, check to make sure it hasn't
|
77
|
+
already been submitted. When submitting a bug report, please include a [Gist][]
|
78
|
+
that includes a stack trace and any details that may be necessary to reproduce
|
79
|
+
the bug, including your gem version, Ruby version, and operating system.
|
80
|
+
Ideally, a bug report should include a pull request with failing specs.
|
81
|
+
|
82
|
+
## Submitting a Pull Request
|
83
|
+
1. [Fork the repository.][fork]
|
84
|
+
2. [Create a topic branch.][branch]
|
85
|
+
3. Add specs for your unimplemented feature or bug fix.
|
86
|
+
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
|
87
|
+
5. Implement your feature or bug fix.
|
88
|
+
6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
|
89
|
+
7. Run `open coverage/index.html`. If your changes are not completely covered
|
90
|
+
by your tests, return to step 3.
|
91
|
+
8. Add documentation for your feature or bug fix.
|
92
|
+
9. Run `bundle exec rake yard`. If your changes are not 100% documented, go
|
93
|
+
back to step 8.
|
94
|
+
10. Add, commit, and push your changes.
|
95
|
+
11. [Submit a pull request.][pr]
|
96
|
+
|
97
|
+
[fork]: http://help.github.com/fork-a-repo/
|
98
|
+
[branch]: http://learn.github.com/p/branching.html
|
99
|
+
[pr]: http://help.github.com/send-pull-requests/
|
100
|
+
|
101
|
+
## Supported Rubies
|
102
|
+
This library aims to support and is [tested against][travis] the following Ruby
|
89
103
|
implementations:
|
90
104
|
|
91
105
|
* Ruby 1.8.7
|
92
|
-
* Ruby 1.9.1
|
93
106
|
* Ruby 1.9.2
|
94
|
-
*
|
95
|
-
*
|
96
|
-
* [
|
107
|
+
* Ruby 1.9.3
|
108
|
+
* Ruby 2.0.0
|
109
|
+
* [JRuby][]
|
110
|
+
* [Rubinius][]
|
111
|
+
|
112
|
+
[jruby]: http://www.jruby.org/
|
113
|
+
[rubinius]: http://rubini.us/
|
97
114
|
|
98
115
|
If something doesn't work on one of these interpreters, it should be considered
|
99
116
|
a bug.
|
@@ -109,8 +126,7 @@ implementation, you will be personally responsible for providing patches in a
|
|
109
126
|
timely fashion. If critical issues for a particular implementation exist at the
|
110
127
|
time of a major release, support for that Ruby version may be dropped.
|
111
128
|
|
112
|
-
##
|
113
|
-
Copyright (c) 2011, Code for America.
|
114
|
-
See [LICENSE](https://github.com/codeforamerica/congress/blob/master/LICENSE.md) for details.
|
129
|
+
## Copyright
|
130
|
+
Copyright (c) 2011-2013, Code for America. See [LICENSE][] for details.
|
115
131
|
|
116
|
-
[
|
132
|
+
[license]: https://github.com/codeforamerica/congress/blob/master/LICENSE.md
|
data/Rakefile
CHANGED
data/congress.gemspec
CHANGED
@@ -2,18 +2,11 @@
|
|
2
2
|
require File.expand_path('../lib/congress/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.add_dependency 'faraday', '~> 0.7'
|
6
|
-
gem.add_dependency 'faraday_middleware', '~> 0.
|
7
|
-
gem.add_dependency 'hashie', '~>
|
8
|
-
gem.add_dependency '
|
9
|
-
gem.
|
10
|
-
gem.add_development_dependency 'json'
|
11
|
-
gem.add_development_dependency 'rake'
|
12
|
-
gem.add_development_dependency 'rdiscount'
|
13
|
-
gem.add_development_dependency 'rspec'
|
14
|
-
gem.add_development_dependency 'simplecov'
|
15
|
-
gem.add_development_dependency 'webmock'
|
16
|
-
gem.add_development_dependency 'yard'
|
5
|
+
gem.add_dependency 'faraday', '~> 0.8.7'
|
6
|
+
gem.add_dependency 'faraday_middleware', '~> 0.9.0'
|
7
|
+
gem.add_dependency 'hashie', '~> 2.0'
|
8
|
+
gem.add_dependency 'rash', '~> 0.4'
|
9
|
+
gem.add_development_dependency 'bundler', '~> 1.0'
|
17
10
|
gem.author = "Erik Michaels-Ober"
|
18
11
|
gem.description = %q{Ruby wrapper for the Real-Time Congress API. The Real-Time Congress API is a RESTful API over the artifacts of Congress, in as close to real-time as possible.}
|
19
12
|
gem.email = 'sferik@gmail.com'
|
data/lib/congress/client.rb
CHANGED
@@ -3,77 +3,127 @@ require 'congress/request'
|
|
3
3
|
|
4
4
|
module Congress
|
5
5
|
class Client
|
6
|
-
include
|
7
|
-
include
|
6
|
+
include Connection
|
7
|
+
include Request
|
8
8
|
|
9
|
-
#
|
9
|
+
# Current legislators' names, IDs, biography, and social media.
|
10
10
|
#
|
11
11
|
# @return [Hashie::Rash]
|
12
12
|
# @example
|
13
13
|
# Congress.key = YOUR_RTC_API_KEY
|
14
|
-
# Congress.
|
15
|
-
def
|
16
|
-
get('/
|
14
|
+
# Congress.legislators
|
15
|
+
def legislators(options={})
|
16
|
+
get('/legislators', options.merge(api_key))
|
17
17
|
end
|
18
18
|
|
19
|
-
#
|
19
|
+
# Find representatives and senators for a latitude/longitude or zip.
|
20
20
|
#
|
21
21
|
# @return [Hashie::Rash]
|
22
22
|
# @example
|
23
23
|
# Congress.key = YOUR_RTC_API_KEY
|
24
|
-
# Congress.
|
25
|
-
|
26
|
-
|
24
|
+
# Congress.legislators_locate(94107)
|
25
|
+
# Congress.legislators_locate(37.775, -122.418)
|
26
|
+
def legislators_locate(*args)
|
27
|
+
options = args.last.is_a?(::Hash) ? args.pop : {}
|
28
|
+
if args.size == 1
|
29
|
+
options[:zip] = args.pop
|
30
|
+
elsif args.size == 2
|
31
|
+
options[:longitude] = args.pop
|
32
|
+
options[:latitude] = args.pop
|
33
|
+
else
|
34
|
+
raise ArgumentError, "Must pass a latitude/longitude or zip"
|
35
|
+
end
|
36
|
+
get('/legislators/locate', options.merge(api_key))
|
37
|
+
end
|
38
|
+
|
39
|
+
# Find congressional districts for a latitude/longitude or zip.
|
40
|
+
#
|
41
|
+
# @return [Hashie::Rash]
|
42
|
+
# @example
|
43
|
+
# Congress.key = YOUR_RTC_API_KEY
|
44
|
+
# Congress.districts_locate(94107)
|
45
|
+
# Congress.districts_locate(37.775, -122.418)
|
46
|
+
def districts_locate(*args)
|
47
|
+
options = args.last.is_a?(::Hash) ? args.pop : {}
|
48
|
+
if args.size == 1
|
49
|
+
options[:zip] = args.pop
|
50
|
+
elsif args.size == 2
|
51
|
+
options[:longitude] = args.pop
|
52
|
+
options[:latitude] = args.pop
|
53
|
+
else
|
54
|
+
raise ArgumentError, "Must pass a latitude/longitude or zip"
|
55
|
+
end
|
56
|
+
get('/districts/locate', options.merge(api_key))
|
57
|
+
end
|
58
|
+
|
59
|
+
# Current committees, subcommittees, and their membership.
|
60
|
+
#
|
61
|
+
# @return [Hashie::Rash]
|
62
|
+
# @example
|
63
|
+
# Congress.key = YOUR_RTC_API_KEY
|
64
|
+
# Congress.committees
|
65
|
+
def committees(options={})
|
66
|
+
get('/committees', options.merge(api_key))
|
27
67
|
end
|
28
68
|
|
29
|
-
#
|
69
|
+
# Legislation in the House and Senate, back to 2009. Updated daily.
|
30
70
|
#
|
31
71
|
# @return [Hashie::Rash]
|
32
72
|
# @example
|
33
73
|
# Congress.key = YOUR_RTC_API_KEY
|
34
|
-
# Congress.
|
35
|
-
def
|
36
|
-
get('/
|
74
|
+
# Congress.bills
|
75
|
+
def bills(options={})
|
76
|
+
get('/bills', options.merge(api_key))
|
37
77
|
end
|
38
78
|
|
39
|
-
#
|
79
|
+
# ull text search over legislation.
|
40
80
|
#
|
41
81
|
# @return [Hashie::Rash]
|
42
82
|
# @example
|
43
83
|
# Congress.key = YOUR_RTC_API_KEY
|
44
|
-
# Congress.
|
45
|
-
def
|
46
|
-
get('/
|
84
|
+
# Congress.bills_search
|
85
|
+
def bills_search(options={})
|
86
|
+
get('/bills/search', options.merge(api_key))
|
87
|
+
end
|
88
|
+
|
89
|
+
# Roll call votes in Congress, back to 2009. Updated within minutes of votes.
|
90
|
+
#
|
91
|
+
# @return [Hashie::Rash]
|
92
|
+
# @example
|
93
|
+
# Congress.key = YOUR_RTC_API_KEY
|
94
|
+
# Congress.votes
|
95
|
+
def votes(options={})
|
96
|
+
get('/votes', options.merge(api_key))
|
47
97
|
end
|
48
98
|
|
49
|
-
#
|
99
|
+
# To-the-minute updates from the floor of the House and Senate.
|
50
100
|
#
|
51
101
|
# @return [Hashie::Rash]
|
52
102
|
# @example
|
53
103
|
# Congress.key = YOUR_RTC_API_KEY
|
54
104
|
# Congress.floor_updates
|
55
105
|
def floor_updates(options={})
|
56
|
-
get('/
|
106
|
+
get('/floor_updates', options.merge(api_key))
|
57
107
|
end
|
58
108
|
|
59
|
-
#
|
109
|
+
# Committee hearings in Congress. Updated as hearings are announced.
|
60
110
|
#
|
61
111
|
# @return [Hashie::Rash]
|
62
112
|
# @example
|
63
113
|
# Congress.key = YOUR_RTC_API_KEY
|
64
|
-
# Congress.
|
65
|
-
def
|
66
|
-
get('/
|
114
|
+
# Congress.hearings
|
115
|
+
def hearings(options={})
|
116
|
+
get('/hearings', options.merge(api_key))
|
67
117
|
end
|
68
118
|
|
69
|
-
#
|
119
|
+
# Bills scheduled for debate in the future, as announced by party leadership.
|
70
120
|
#
|
71
121
|
# @return [Hashie::Rash]
|
72
122
|
# @example
|
73
123
|
# Congress.key = YOUR_RTC_API_KEY
|
74
|
-
# Congress.
|
75
|
-
def
|
76
|
-
get('/
|
124
|
+
# Congress.upcoming_bills
|
125
|
+
def upcoming_bills(options={})
|
126
|
+
get('/upcoming_bills', options.merge(api_key))
|
77
127
|
end
|
78
128
|
|
79
129
|
private
|
data/lib/congress/connection.rb
CHANGED
@@ -5,7 +5,7 @@ module Congress
|
|
5
5
|
private
|
6
6
|
|
7
7
|
def connection
|
8
|
-
Faraday.new(:url => 'http://api.
|
8
|
+
Faraday.new(:url => 'http://congress.api.sunlightfoundation.com') do |connection|
|
9
9
|
connection.use Faraday::Request::UrlEncoded
|
10
10
|
connection.use Faraday::Response::RaiseError
|
11
11
|
connection.use Faraday::Response::Rashify
|
data/lib/congress/version.rb
CHANGED
@@ -8,108 +8,187 @@ describe Congress::Client do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
describe '#
|
11
|
+
describe '#legislators' do
|
12
12
|
before do
|
13
|
-
stub_get('/
|
14
|
-
to_return(:status => 200, :body => fixture('
|
13
|
+
stub_get('/legislators?apikey=abc123').
|
14
|
+
to_return(:status => 200, :body => fixture('legislators.json'))
|
15
15
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
a_get('/api/v1/bills.json?apikey=abc123').
|
16
|
+
it "fetches current legislators' names, IDs, biography, and social media" do
|
17
|
+
legislators = @client.legislators
|
18
|
+
a_get('/legislators?apikey=abc123').
|
20
19
|
should have_been_made
|
21
|
-
|
22
|
-
|
20
|
+
legislators['count'].should == 539
|
21
|
+
legislators['results'].first.bioguide_id.should == "K000385"
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
|
-
describe '#
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
describe '#legislators_locate' do
|
26
|
+
context "with a zip code passed" do
|
27
|
+
before do
|
28
|
+
stub_get('/legislators/locate?apikey=abc123&zip=94107').
|
29
|
+
to_return(:status => 200, :body => fixture('legislators_locate.json'))
|
30
|
+
end
|
31
|
+
it "fetches representatives and senators for a latitude/longitude or zip" do
|
32
|
+
legislators_locate = @client.legislators_locate(94107)
|
33
|
+
a_get('/legislators/locate?apikey=abc123&zip=94107').
|
34
|
+
should have_been_made
|
35
|
+
legislators_locate['count'].should == 3
|
36
|
+
legislators_locate['results'].first.bioguide_id.should == "P000197"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
context "with a latitude and longitude passed" do
|
40
|
+
before do
|
41
|
+
stub_get('/legislators/locate?apikey=abc123&latitude=37.775&longitude=-122.418').
|
42
|
+
to_return(:status => 200, :body => fixture('legislators_locate.json'))
|
43
|
+
end
|
44
|
+
it "fetches representatives and senators for a latitude/longitude or zip" do
|
45
|
+
legislators_locate = @client.legislators_locate(37.775, -122.418)
|
46
|
+
a_get('/legislators/locate?apikey=abc123&latitude=37.775&longitude=-122.418').
|
47
|
+
should have_been_made
|
48
|
+
legislators_locate['count'].should == 3
|
49
|
+
legislators_locate['results'].first.bioguide_id.should == "P000197"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
context "with no arguments passed" do
|
53
|
+
it "raises an argument error" do
|
54
|
+
lambda {
|
55
|
+
@client.legislators_locate
|
56
|
+
}.should raise_error ArgumentError
|
57
|
+
end
|
30
58
|
end
|
59
|
+
end
|
31
60
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
61
|
+
describe '#districts_locate' do
|
62
|
+
context "with a zip code passed" do
|
63
|
+
before do
|
64
|
+
stub_get('/districts/locate?apikey=abc123&zip=94107').
|
65
|
+
to_return(:status => 200, :body => fixture('districts_locate.json'))
|
66
|
+
end
|
67
|
+
it "fetches congressional districts for a latitude/longitude or zip" do
|
68
|
+
districts_locate = @client.districts_locate(94107)
|
69
|
+
a_get('/districts/locate?apikey=abc123&zip=94107').
|
70
|
+
should have_been_made
|
71
|
+
districts_locate['count'].should == 1
|
72
|
+
districts_locate['results'].first.district.should == 12
|
73
|
+
end
|
74
|
+
end
|
75
|
+
context "with a latitude and longitude passed" do
|
76
|
+
before do
|
77
|
+
stub_get('/districts/locate?apikey=abc123&latitude=37.775&longitude=-122.418').
|
78
|
+
to_return(:status => 200, :body => fixture('districts_locate.json'))
|
79
|
+
end
|
80
|
+
it "fetches congressional districts for a latitude/longitude or zip" do
|
81
|
+
districts_locate = @client.districts_locate(37.775, -122.418)
|
82
|
+
a_get('/districts/locate?apikey=abc123&latitude=37.775&longitude=-122.418').
|
83
|
+
should have_been_made
|
84
|
+
districts_locate['count'].should == 1
|
85
|
+
districts_locate['results'].first.district.should == 12
|
86
|
+
end
|
87
|
+
end
|
88
|
+
context "with no arguments passed" do
|
89
|
+
it "raises an argument error" do
|
90
|
+
lambda {
|
91
|
+
@client.districts_locate
|
92
|
+
}.should raise_error ArgumentError
|
93
|
+
end
|
38
94
|
end
|
39
95
|
end
|
40
96
|
|
41
|
-
describe '#
|
97
|
+
describe '#committees' do
|
42
98
|
before do
|
43
|
-
stub_get('/
|
44
|
-
to_return(:status => 200, :body => fixture('
|
99
|
+
stub_get('/committees?apikey=abc123').
|
100
|
+
to_return(:status => 200, :body => fixture('committees.json'))
|
101
|
+
end
|
102
|
+
it "fetches legislation in the House and Senate" do
|
103
|
+
committees = @client.committees
|
104
|
+
a_get('/committees?apikey=abc123').
|
105
|
+
should have_been_made
|
106
|
+
committees['count'].should == 120
|
107
|
+
committees['results'].first.chamber.should == "senate"
|
45
108
|
end
|
109
|
+
end
|
46
110
|
|
47
|
-
|
48
|
-
|
49
|
-
|
111
|
+
describe '#bills' do
|
112
|
+
before do
|
113
|
+
stub_get('/bills?apikey=abc123').
|
114
|
+
to_return(:status => 200, :body => fixture('bills.json'))
|
115
|
+
end
|
116
|
+
it "fetches legislation in the House and Senate" do
|
117
|
+
bills = @client.bills
|
118
|
+
a_get('/bills?apikey=abc123').
|
50
119
|
should have_been_made
|
51
|
-
|
52
|
-
|
120
|
+
bills['count'].should == 28614
|
121
|
+
bills['results'].first.bill_id.should == "s730-113"
|
53
122
|
end
|
54
123
|
end
|
55
124
|
|
56
|
-
describe '#
|
125
|
+
describe '#bills_search' do
|
57
126
|
before do
|
58
|
-
stub_get('/
|
59
|
-
to_return(:status => 200, :body => fixture('
|
127
|
+
stub_get('/bills/search?apikey=abc123').
|
128
|
+
to_return(:status => 200, :body => fixture('bills_search.json'))
|
129
|
+
end
|
130
|
+
it "fetches legislation" do
|
131
|
+
bills_search = @client.bills_search
|
132
|
+
a_get('/bills/search?apikey=abc123').
|
133
|
+
should have_been_made
|
134
|
+
bills_search['count'].should == 28614
|
135
|
+
bills_search['results'].first.bill_type.should == "hr"
|
60
136
|
end
|
137
|
+
end
|
61
138
|
|
62
|
-
|
63
|
-
|
64
|
-
|
139
|
+
describe '#votes' do
|
140
|
+
before do
|
141
|
+
stub_get('/votes?apikey=abc123').
|
142
|
+
to_return(:status => 200, :body => fixture('votes.json'))
|
143
|
+
end
|
144
|
+
it "fetches roll call votes in Congress" do
|
145
|
+
votes = @client.votes
|
146
|
+
a_get('/votes?apikey=abc123').
|
65
147
|
should have_been_made
|
66
|
-
|
67
|
-
|
148
|
+
votes['count'].should == 4647
|
149
|
+
votes['results'].first.roll_id.should == "h106-2013"
|
68
150
|
end
|
69
151
|
end
|
70
152
|
|
71
153
|
describe '#floor_updates' do
|
72
154
|
before do
|
73
|
-
stub_get('/
|
155
|
+
stub_get('/floor_updates?apikey=abc123').
|
74
156
|
to_return(:status => 200, :body => fixture('floor_updates.json'))
|
75
157
|
end
|
76
|
-
|
77
|
-
it "should fetch updates from the floor of each chamber of Congress" do
|
158
|
+
it "fetches to-the-minute updates from the floor of the House and Senate" do
|
78
159
|
floor_updates = @client.floor_updates
|
79
|
-
a_get('/
|
160
|
+
a_get('/floor_updates?apikey=abc123').
|
80
161
|
should have_been_made
|
81
|
-
floor_updates['count'].should ==
|
82
|
-
floor_updates['
|
162
|
+
floor_updates['count'].should == 3066
|
163
|
+
floor_updates['results'].first.chamber.should == "senate"
|
83
164
|
end
|
84
165
|
end
|
85
166
|
|
86
|
-
describe '#
|
167
|
+
describe '#hearings' do
|
87
168
|
before do
|
88
|
-
stub_get('/
|
89
|
-
to_return(:status => 200, :body => fixture('
|
169
|
+
stub_get('/hearings?apikey=abc123').
|
170
|
+
to_return(:status => 200, :body => fixture('hearings.json'))
|
90
171
|
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
a_get('/api/v1/committee_hearings.json?apikey=abc123').
|
172
|
+
it "fetches committee hearings in Congress" do
|
173
|
+
hearings = @client.hearings
|
174
|
+
a_get('/hearings?apikey=abc123').
|
95
175
|
should have_been_made
|
96
|
-
|
97
|
-
|
176
|
+
hearings['count'].should == 1279
|
177
|
+
hearings['results'].first.committee_id.should == "SSFR"
|
98
178
|
end
|
99
179
|
end
|
100
180
|
|
101
|
-
describe '#
|
181
|
+
describe '#upcoming_bills' do
|
102
182
|
before do
|
103
|
-
stub_get('/
|
104
|
-
to_return(:status => 200, :body => fixture('
|
183
|
+
stub_get('/upcoming_bills?apikey=abc123').
|
184
|
+
to_return(:status => 200, :body => fixture('upcoming_bills.json'))
|
105
185
|
end
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
a_get('/api/v1/documents.json?apikey=abc123').
|
186
|
+
it "fetches committee hearings in Congress" do
|
187
|
+
upcoming_bills = @client.upcoming_bills
|
188
|
+
a_get('/upcoming_bills?apikey=abc123').
|
110
189
|
should have_been_made
|
111
|
-
|
112
|
-
|
190
|
+
upcoming_bills['count'].should == 9
|
191
|
+
upcoming_bills['results'].first.bill_id.should == "s3457-113"
|
113
192
|
end
|
114
193
|
end
|
115
194
|
|