govkit 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/.travis.yml +2 -0
  2. data/Gemfile +11 -5
  3. data/README.md +1 -1
  4. data/Rakefile +29 -13
  5. data/VERSION +1 -1
  6. data/govkit.gemspec +25 -36
  7. data/lib/gov_kit.rb +16 -5
  8. data/lib/gov_kit/configuration.rb +5 -5
  9. data/lib/gov_kit/follow_the_money.rb +5 -2
  10. data/lib/gov_kit/open_congress.rb +3 -11
  11. data/lib/gov_kit/open_congress/bill.rb +32 -29
  12. data/lib/gov_kit/open_congress/person.rb +21 -20
  13. data/lib/gov_kit/open_states.rb +10 -15
  14. data/lib/gov_kit/railtie.rb +0 -2
  15. data/lib/gov_kit/resource.rb +0 -1
  16. data/lib/gov_kit/transparency_data.rb +1 -1
  17. data/lib/gov_kit/vote_smart.rb +81 -6
  18. data/{init.rb → rails/init.rb} +0 -0
  19. data/spec/fixtures/open_states/401.response +9 -9
  20. data/spec/fixtures/open_states/404.response +9 -9
  21. data/spec/fixtures/open_states/bill.response +9 -240
  22. data/spec/fixtures/open_states/bill_find.response +9 -0
  23. data/spec/fixtures/open_states/bill_query.response +9 -1990
  24. data/spec/fixtures/open_states/committee_find.response +9 -53
  25. data/spec/fixtures/open_states/committee_query.response +9 -190
  26. data/spec/fixtures/open_states/legislator_find.response +9 -0
  27. data/spec/fixtures/open_states/legislator_query.response +9 -144
  28. data/spec/fixtures/open_states/state.response +9 -60
  29. data/spec/follow_the_money_spec.rb +20 -16
  30. data/spec/open_congress_spec.rb +23 -35
  31. data/spec/open_states_spec.rb +63 -78
  32. data/spec/search_engines_spec.rb +10 -13
  33. data/spec/spec_helper.rb +16 -8
  34. data/spec/transparency_data_spec.rb +19 -35
  35. metadata +140 -145
  36. data/spec/fixtures/open_states/410.response +0 -6
  37. data/spec/fixtures/open_states/legislator.response +0 -34
@@ -1,30 +1,24 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
- # Provides "String.singularize"
4
- # which is used by resource_for_collection, in resource.rb
5
- require 'active_support/inflector'
6
-
7
- # Provides string.last()
8
- # which is used by method_missing in resource.rb
9
- require 'active_support/core_ext/string'
10
-
11
3
  module GovKit::TransparencyData
12
4
 
13
5
  describe GovKit::TransparencyData do
14
6
  before(:all) do
15
- base_uri = GovKit::TransparencyDataResource.base_uri.gsub(/\./, '\.')
16
-
17
- urls = [
18
- ['/contributions.json\?', 'contributions.response'],
19
- ['/lobbying.json\?', 'lobbyists_find_all.response'],
20
- ['/grants.json\?', 'grants_find_all.response'],
21
- ['/entities.json\?apikey=&search=$', 'entities_search.response'],
22
- ['/entities.json\?apikey=&search=harry%20pelosi', 'entities_search_limit_0.response'],
23
- ['/entities.json\?apikey=&search=nancy%2Bpelosi', 'entities_search_limit_1.response']
24
- ]
25
-
26
- urls.each do |u|
27
- FakeWeb.register_uri(:get, %r|#{base_uri}#{u[0]}|, :response => File.join(FIXTURES_DIR, 'transparency_data', u[1]))
7
+ unless FakeWeb.allow_net_connect?
8
+ base_uri = GovKit::TransparencyDataResource.base_uri.gsub(/\./, '\.')
9
+
10
+ urls = [
11
+ ['/contributions.json\?', 'contributions.response'],
12
+ ['/lobbying.json\?', 'lobbyists_find_all.response'],
13
+ ['/grants.json\?', 'grants_find_all.response'],
14
+ ['/entities.json\?apikey=&search=$', 'entities_search.response'],
15
+ ['/entities.json\?apikey=&search=harry%20pelosi', 'entities_search_limit_0.response'],
16
+ ['/entities.json\?apikey=&search=nancy%2Bpelosi', 'entities_search_limit_1.response']
17
+ ]
18
+
19
+ urls.each do |u|
20
+ FakeWeb.register_uri(:get, %r|#{base_uri}#{u[0]}|, :response => File.join(FIXTURES_DIR, 'transparency_data', u[1]))
21
+ end
28
22
  end
29
23
  end
30
24
 
@@ -42,7 +36,7 @@ module GovKit::TransparencyData
42
36
  @contributions = Contribution.search
43
37
  end.should_not raise_error
44
38
 
45
- @contributions.length.should eql(8)
39
+ @contributions.length.should eql(FakeWeb.allow_net_connect? ? 1000 : 8)
46
40
  @contributions[0].contributor_city.should eql("ANCHORAGE")
47
41
  end
48
42
  end
@@ -50,16 +44,6 @@ module GovKit::TransparencyData
50
44
 
51
45
  describe Entity do
52
46
  context "#search" do
53
- it "should find all entities" do
54
- lambda do
55
- @entities = Entity.search
56
- end.should_not raise_error
57
-
58
- @entities.length.should eql(2)
59
- @entities[0].name.should eql("Nancy Pelosi (D)")
60
- @entities[1].name.should eql("Nancy Pelosi for Congress")
61
- end
62
-
63
47
  it 'should return an empty list when no elements found' do
64
48
  lambda do
65
49
  @entities = Entity.search( "harry pelosi" )
@@ -72,7 +56,7 @@ module GovKit::TransparencyData
72
56
  @entities = Entity.search( "nancy+pelosi" )
73
57
  end.should_not raise_error
74
58
 
75
- @entities.length.should eql(1)
59
+ @entities.length.should eql(FakeWeb.allow_net_connect? ? 2 : 1)
76
60
  end
77
61
  end
78
62
  end
@@ -84,7 +68,7 @@ module GovKit::TransparencyData
84
68
  @records = LobbyingRecord.search
85
69
  end.should_not raise_error
86
70
 
87
- @records.length.should eql(5)
71
+ @records.length.should eql(FakeWeb.allow_net_connect? ? 1000 : 5)
88
72
  @records[0].lobbyists[0].lobbyist_name.should eql('Dunn, Jennifer B')
89
73
  end
90
74
  end
@@ -97,7 +81,7 @@ module GovKit::TransparencyData
97
81
  @records = Grant.search
98
82
  end.should_not raise_error
99
83
 
100
- @records.length.should eql(3)
84
+ @records.length.should eql(FakeWeb.allow_net_connect? ? 1000 : 3)
101
85
  @records[0].project_description.should eql('NATIONAL FLOOD INSURANCE PROGRAM')
102
86
  end
103
87
  end
metadata CHANGED
@@ -1,152 +1,159 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: govkit
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 7
8
- - 2
9
- version: 0.7.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Participatory Politics Foundation
13
9
  - Srinivas Aki
14
10
  - Carl Tashian
15
11
  autorequire:
16
12
  bindir: bin
17
13
  cert_chain: []
18
-
19
- date: 2012-01-23 00:00:00 -08:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- prerelease: false
24
- name: govkit
14
+ date: 2012-11-20 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: i18n
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
25
24
  type: :runtime
26
- version_requirements: &id001 !ruby/object:Gem::Requirement
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- segments:
31
- - 0
32
- version: "0"
33
- requirement: *id001
34
- - !ruby/object:Gem::Dependency
35
25
  prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ - !ruby/object:Gem::Dependency
36
33
  name: activesupport
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
37
40
  type: :runtime
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 0
44
- version: "0"
45
- requirement: *id002
46
- - !ruby/object:Gem::Dependency
47
41
  prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
48
49
  name: nokogiri
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 1.5.5
49
56
  type: :runtime
50
- version_requirements: &id003 !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
- version: "0"
57
- requirement: *id003
58
- - !ruby/object:Gem::Dependency
59
57
  prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: 1.5.5
64
+ - !ruby/object:Gem::Dependency
60
65
  name: httparty
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: 0.7.4
61
72
  type: :runtime
62
- version_requirements: &id004 !ruby/object:Gem::Requirement
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- segments:
67
- - 0
68
- version: "0"
69
- requirement: *id004
70
- - !ruby/object:Gem::Dependency
71
- prerelease: false
72
- name: i18n
73
- type: :runtime
74
- version_requirements: &id005 !ruby/object:Gem::Requirement
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- segments:
79
- - 0
80
- version: "0"
81
- requirement: *id005
82
- - !ruby/object:Gem::Dependency
83
73
  prerelease: false
84
- name: httparty
85
- type: :runtime
86
- version_requirements: &id006 !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- segments:
91
- - 0
92
- - 7
93
- - 4
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
94
79
  version: 0.7.4
95
- requirement: *id006
96
- - !ruby/object:Gem::Dependency
97
- prerelease: false
80
+ - !ruby/object:Gem::Dependency
98
81
  name: json
99
- type: :runtime
100
- version_requirements: &id007 !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- segments:
105
- - 1
106
- - 4
107
- - 3
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
108
87
  version: 1.4.3
109
- requirement: *id007
110
- - !ruby/object:Gem::Dependency
111
- prerelease: false
112
- name: nokogiri
113
88
  type: :runtime
114
- version_requirements: &id008 !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- segments:
119
- - 1
120
- - 4
121
- - 4
122
- version: 1.4.4
123
- requirement: *id008
124
- - !ruby/object:Gem::Dependency
125
89
  prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: 1.4.3
96
+ - !ruby/object:Gem::Dependency
126
97
  name: fastercsv
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.5.3
127
104
  type: :runtime
128
- version_requirements: &id009 !ruby/object:Gem::Requirement
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- segments:
133
- - 1
134
- - 5
135
- - 3
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
136
111
  version: 1.5.3
137
- requirement: *id009
138
- description: Govkit lets you quickly get encapsulated Ruby objects for common open government APIs. We're starting with Sunlight's Open States API and the Project Vote Smart API.
112
+ - !ruby/object:Gem::Dependency
113
+ name: jeweler
114
+ requirement: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ - !ruby/object:Gem::Dependency
129
+ name: rake
130
+ requirement: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ description: Govkit lets you quickly get encapsulated Ruby objects for common open
145
+ government APIs. We're starting with Sunlight's Open States API and the Project
146
+ Vote Smart API.
139
147
  email: develop@opencongress.org
140
148
  executables: []
141
-
142
149
  extensions: []
143
-
144
- extra_rdoc_files:
150
+ extra_rdoc_files:
145
151
  - LICENSE
146
152
  - README.md
147
- files:
153
+ files:
148
154
  - .document
149
155
  - .rspec
156
+ - .travis.yml
150
157
  - Gemfile
151
158
  - LICENSE
152
159
  - README.md
@@ -158,7 +165,6 @@ files:
158
165
  - generators/govkit/templates/govkit.rb
159
166
  - generators/govkit/templates/mention.rb
160
167
  - govkit.gemspec
161
- - init.rb
162
168
  - lib/generators/govkit/govkit_generator.rb
163
169
  - lib/generators/govkit/templates/create_mentions.rb
164
170
  - lib/generators/govkit/templates/govkit.rb
@@ -188,6 +194,7 @@ files:
188
194
  - lib/gov_kit/transparency_data.rb
189
195
  - lib/gov_kit/vote_smart.rb
190
196
  - lib/govkit.rb
197
+ - rails/init.rb
191
198
  - spec/fixtures/bing/news_search.response
192
199
  - spec/fixtures/bing/no_results.response
193
200
  - spec/fixtures/follow_the_money/business-page0.response
@@ -201,12 +208,12 @@ files:
201
208
  - spec/fixtures/open_congress/person.response
202
209
  - spec/fixtures/open_states/401.response
203
210
  - spec/fixtures/open_states/404.response
204
- - spec/fixtures/open_states/410.response
205
211
  - spec/fixtures/open_states/bill.response
212
+ - spec/fixtures/open_states/bill_find.response
206
213
  - spec/fixtures/open_states/bill_query.response
207
214
  - spec/fixtures/open_states/committee_find.response
208
215
  - spec/fixtures/open_states/committee_query.response
209
- - spec/fixtures/open_states/legislator.response
216
+ - spec/fixtures/open_states/legislator_find.response
210
217
  - spec/fixtures/open_states/legislator_query.response
211
218
  - spec/fixtures/open_states/state.response
212
219
  - spec/fixtures/search_engines/google_news.response
@@ -222,40 +229,28 @@ files:
222
229
  - spec/search_engines_spec.rb
223
230
  - spec/spec_helper.rb
224
231
  - spec/transparency_data_spec.rb
225
- has_rdoc: true
226
232
  homepage: http://github.com/opengovernment/govkit
227
233
  licenses: []
228
-
229
234
  post_install_message:
230
235
  rdoc_options: []
231
-
232
- require_paths:
236
+ require_paths:
233
237
  - lib
234
- required_ruby_version: !ruby/object:Gem::Requirement
235
- requirements:
236
- - - ">="
237
- - !ruby/object:Gem::Version
238
- segments:
239
- - 0
240
- version: "0"
241
- required_rubygems_version: !ruby/object:Gem::Requirement
242
- requirements:
243
- - - ">="
244
- - !ruby/object:Gem::Version
245
- segments:
246
- - 0
247
- version: "0"
238
+ required_ruby_version: !ruby/object:Gem::Requirement
239
+ none: false
240
+ requirements:
241
+ - - ! '>='
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ required_rubygems_version: !ruby/object:Gem::Requirement
245
+ none: false
246
+ requirements:
247
+ - - ! '>='
248
+ - !ruby/object:Gem::Version
249
+ version: '0'
248
250
  requirements: []
249
-
250
251
  rubyforge_project:
251
- rubygems_version: 1.3.6
252
+ rubygems_version: 1.8.24
252
253
  signing_key:
253
254
  specification_version: 3
254
255
  summary: Simple access to open government APIs around the web
255
- test_files:
256
- - spec/follow_the_money_spec.rb
257
- - spec/open_congress_spec.rb
258
- - spec/open_states_spec.rb
259
- - spec/search_engines_spec.rb
260
- - spec/spec_helper.rb
261
- - spec/transparency_data_spec.rb
256
+ test_files: []