congress 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.travis.yml +2 -2
- data/Gemfile +0 -6
- data/lib/congress/client.rb +9 -2
- data/lib/congress/version.rb +1 -1
- data/spec/congress/client_spec.rb +7 -1
- metadata +27 -5
- metadata.gz.sig +0 -0
- checksums.yaml +0 -7
- checksums.yaml.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
@@ -11,7 +11,7 @@ rvm:
|
|
11
11
|
- 1.9.3
|
12
12
|
- 2.0.0
|
13
13
|
- 2.1.0
|
14
|
-
- rbx
|
14
|
+
- rbx-2
|
15
15
|
- ruby-head
|
16
16
|
matrix:
|
17
17
|
include:
|
@@ -23,6 +23,6 @@ matrix:
|
|
23
23
|
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
24
24
|
allow_failures:
|
25
25
|
- rvm: jruby-head
|
26
|
-
- rvm: rbx
|
26
|
+
- rvm: rbx-2
|
27
27
|
- rvm: ruby-head
|
28
28
|
fast_finish: true
|
data/Gemfile
CHANGED
data/lib/congress/client.rb
CHANGED
@@ -67,7 +67,7 @@ module Congress
|
|
67
67
|
get('/bills', options)
|
68
68
|
end
|
69
69
|
|
70
|
-
#
|
70
|
+
# Full text search over legislation.
|
71
71
|
#
|
72
72
|
# @return [Hashie::Rash]
|
73
73
|
# @example
|
@@ -123,7 +123,7 @@ module Congress
|
|
123
123
|
options = args.last.is_a?(::Hash) ? args.pop : {}
|
124
124
|
case [args.size, args.first.class]
|
125
125
|
when [1, Fixnum]
|
126
|
-
options.merge(:zip => args.pop)
|
126
|
+
options.merge(:zip => to_zip_code(args.pop))
|
127
127
|
when [1, String]
|
128
128
|
placemark = Geocoder.search(args.pop).first
|
129
129
|
options.merge(:longitude => placemark.longitude, :latitude => placemark.latitude)
|
@@ -133,5 +133,12 @@ module Congress
|
|
133
133
|
fail ArgumentError, 'Must pass a latitude/longitude, zip or address'
|
134
134
|
end
|
135
135
|
end
|
136
|
+
|
137
|
+
# Proper zip code from a number, adding leading zeroes if required
|
138
|
+
# @param number [Integer] zip code as an integer
|
139
|
+
# @return [String]
|
140
|
+
def to_zip_code(number)
|
141
|
+
sprintf('%05d', number)
|
142
|
+
end
|
136
143
|
end
|
137
144
|
end
|
data/lib/congress/version.rb
CHANGED
@@ -23,7 +23,7 @@ describe Congress::Client do
|
|
23
23
|
describe '#legislators_locate' do
|
24
24
|
context 'with a zip code passed' do
|
25
25
|
before do
|
26
|
-
stub_get('/legislators/locate
|
26
|
+
stub_get('/legislators/locate').with(:query => hash_including('zip')).
|
27
27
|
to_return(:status => 200, :body => fixture('legislators_locate.json'))
|
28
28
|
end
|
29
29
|
it 'fetches representatives and senators for a zip code' do
|
@@ -32,6 +32,12 @@ describe Congress::Client do
|
|
32
32
|
expect(legislators_locate['count']).to eq(3)
|
33
33
|
expect(legislators_locate['results'].first.bioguide_id).to eq('P000197')
|
34
34
|
end
|
35
|
+
context 'zip code with leading zeroes' do
|
36
|
+
it 'pads with leading zeroes' do
|
37
|
+
@client.legislators_locate(6511)
|
38
|
+
expect(a_get('/legislators/locate?zip=06511').with(:headers => {'X-APIKEY' => 'abc123'})).to have_been_made
|
39
|
+
end
|
40
|
+
end
|
35
41
|
end
|
36
42
|
context 'with a latitude and longitude passed' do
|
37
43
|
before do
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: congress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Erik Michaels-Ober
|
@@ -29,11 +30,12 @@ cert_chain:
|
|
29
30
|
Sf3lVKpBCWgRpGTvy45XVpB+59y33PJmEuQ1PTEOYvQyao9UKMAAaAN/7qWQtjl0
|
30
31
|
hlw=
|
31
32
|
-----END CERTIFICATE-----
|
32
|
-
date: 2014-
|
33
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
33
34
|
dependencies:
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
36
|
name: faraday
|
36
37
|
requirement: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
37
39
|
requirements:
|
38
40
|
- - "~>"
|
39
41
|
- !ruby/object:Gem::Version
|
@@ -41,6 +43,7 @@ dependencies:
|
|
41
43
|
type: :runtime
|
42
44
|
prerelease: false
|
43
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
44
47
|
requirements:
|
45
48
|
- - "~>"
|
46
49
|
- !ruby/object:Gem::Version
|
@@ -48,6 +51,7 @@ dependencies:
|
|
48
51
|
- !ruby/object:Gem::Dependency
|
49
52
|
name: faraday_middleware
|
50
53
|
requirement: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
51
55
|
requirements:
|
52
56
|
- - "~>"
|
53
57
|
- !ruby/object:Gem::Version
|
@@ -55,6 +59,7 @@ dependencies:
|
|
55
59
|
type: :runtime
|
56
60
|
prerelease: false
|
57
61
|
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
58
63
|
requirements:
|
59
64
|
- - "~>"
|
60
65
|
- !ruby/object:Gem::Version
|
@@ -62,6 +67,7 @@ dependencies:
|
|
62
67
|
- !ruby/object:Gem::Dependency
|
63
68
|
name: hashie
|
64
69
|
requirement: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
@@ -69,6 +75,7 @@ dependencies:
|
|
69
75
|
type: :runtime
|
70
76
|
prerelease: false
|
71
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
72
79
|
requirements:
|
73
80
|
- - "~>"
|
74
81
|
- !ruby/object:Gem::Version
|
@@ -76,6 +83,7 @@ dependencies:
|
|
76
83
|
- !ruby/object:Gem::Dependency
|
77
84
|
name: json
|
78
85
|
requirement: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
79
87
|
requirements:
|
80
88
|
- - "~>"
|
81
89
|
- !ruby/object:Gem::Version
|
@@ -83,6 +91,7 @@ dependencies:
|
|
83
91
|
type: :runtime
|
84
92
|
prerelease: false
|
85
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
86
95
|
requirements:
|
87
96
|
- - "~>"
|
88
97
|
- !ruby/object:Gem::Version
|
@@ -90,6 +99,7 @@ dependencies:
|
|
90
99
|
- !ruby/object:Gem::Dependency
|
91
100
|
name: rash
|
92
101
|
requirement: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
93
103
|
requirements:
|
94
104
|
- - "~>"
|
95
105
|
- !ruby/object:Gem::Version
|
@@ -97,6 +107,7 @@ dependencies:
|
|
97
107
|
type: :runtime
|
98
108
|
prerelease: false
|
99
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
100
111
|
requirements:
|
101
112
|
- - "~>"
|
102
113
|
- !ruby/object:Gem::Version
|
@@ -104,6 +115,7 @@ dependencies:
|
|
104
115
|
- !ruby/object:Gem::Dependency
|
105
116
|
name: geocoder
|
106
117
|
requirement: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
107
119
|
requirements:
|
108
120
|
- - "~>"
|
109
121
|
- !ruby/object:Gem::Version
|
@@ -111,6 +123,7 @@ dependencies:
|
|
111
123
|
type: :runtime
|
112
124
|
prerelease: false
|
113
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
114
127
|
requirements:
|
115
128
|
- - "~>"
|
116
129
|
- !ruby/object:Gem::Version
|
@@ -118,6 +131,7 @@ dependencies:
|
|
118
131
|
- !ruby/object:Gem::Dependency
|
119
132
|
name: bundler
|
120
133
|
requirement: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
@@ -125,6 +139,7 @@ dependencies:
|
|
125
139
|
type: :development
|
126
140
|
prerelease: false
|
127
141
|
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
none: false
|
128
143
|
requirements:
|
129
144
|
- - "~>"
|
130
145
|
- !ruby/object:Gem::Version
|
@@ -171,26 +186,33 @@ files:
|
|
171
186
|
homepage: https://github.com/codeforamerica/congress
|
172
187
|
licenses:
|
173
188
|
- MIT
|
174
|
-
metadata: {}
|
175
189
|
post_install_message:
|
176
190
|
rdoc_options: []
|
177
191
|
require_paths:
|
178
192
|
- lib
|
179
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
+
none: false
|
180
195
|
requirements:
|
181
196
|
- - ">="
|
182
197
|
- !ruby/object:Gem::Version
|
183
198
|
version: '0'
|
199
|
+
segments:
|
200
|
+
- 0
|
201
|
+
hash: 532612501120204924
|
184
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
|
+
none: false
|
185
204
|
requirements:
|
186
205
|
- - ">="
|
187
206
|
- !ruby/object:Gem::Version
|
188
207
|
version: '0'
|
208
|
+
segments:
|
209
|
+
- 0
|
210
|
+
hash: 532612501120204924
|
189
211
|
requirements: []
|
190
212
|
rubyforge_project:
|
191
|
-
rubygems_version:
|
213
|
+
rubygems_version: 1.8.29
|
192
214
|
signing_key:
|
193
|
-
specification_version:
|
215
|
+
specification_version: 3
|
194
216
|
summary: Ruby wrapper for the Sunlight Congress API
|
195
217
|
test_files:
|
196
218
|
- spec/congress/client_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: dc99e0d62cf703391f40a4ed7616465dec13ce5c
|
4
|
-
data.tar.gz: 20dac4fda3dc21e5e9cf1dc4689d22c9aee6e525
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 42cdb0f6d8350b143efb903cd6e499ce3641736d9df0ab5e068f37d077d3854e76bea8f728f86853fb9515162dfc6f311c974c638492870a0e9bae025befe67f
|
7
|
-
data.tar.gz: 5475793e4c807877e443a64fb719582f6c4e507009414276bde67e79a050fc3b8387a337d3ad8ea72f42eba3670faa0bf95399c515ecf1c1272ac61184752b63
|
checksums.yaml.gz.sig
DELETED
Binary file
|