google-civic-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,290 @@
1
+ {
2
+ "kind": "civicinfo#voterinforesponse",
3
+ "status": "success",
4
+ "election": {
5
+ "id": "2000",
6
+ "name": "VIP Test Election",
7
+ "electionDay": "2013-06-06"
8
+ },
9
+ "normalizedInput": {
10
+ "line1": "1263 Pacific Ave",
11
+ "city": "Kansas City",
12
+ "state": "KS",
13
+ "zip": "66102"
14
+ },
15
+ "pollingLocations": [
16
+ {
17
+ "address": {
18
+ "locationName": "National Guard Armory",
19
+ "line1": "100 S 20th St",
20
+ "line2": "",
21
+ "line3": "",
22
+ "city": "Kansas City",
23
+ "state": "KS",
24
+ "zip": "66102 "
25
+ },
26
+ "pollingHours": " - "
27
+ }
28
+ ],
29
+ "contests": [
30
+ {
31
+ "type": "General",
32
+ "office": "Attorney"
33
+ },
34
+ {
35
+ "type": "General",
36
+ "office": "Sheriff"
37
+ },
38
+ {
39
+ "type": "General",
40
+ "office": "Kansas Representative 32",
41
+ "district": {
42
+ "name": "Kansas Representative 32",
43
+ "scope": "stateLower",
44
+ "id": "32"
45
+ },
46
+ "sources": [
47
+ {
48
+ "name": "Voting Information Project",
49
+ "official": true
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "type": "General",
55
+ "office": "Governor/Lt. Governor",
56
+ "candidates": [
57
+ {
58
+ "name": "Andrew P. Gray",
59
+ "party": "Libertarian",
60
+ "email": "chair@lpks.org"
61
+ },
62
+ {
63
+ "name": "Kenneth (ken) W. Cannon",
64
+ "party": "Reform"
65
+ },
66
+ {
67
+ "name": "Tom Holland",
68
+ "party": "Democratic",
69
+ "candidateUrl": "www.tomhollandforkansas.com",
70
+ "email": "info@tomhollandforkansas.com"
71
+ },
72
+ {
73
+ "name": "Sam Brownback",
74
+ "party": "Republican",
75
+ "candidateUrl": "www.brownbackforkansas.com",
76
+ "email": "media@brownback.com"
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ "type": "General",
82
+ "office": "KCKCC Member AL Brd of Trustee"
83
+ },
84
+ {
85
+ "type": "General",
86
+ "office": "Secretary of State",
87
+ "candidates": [
88
+ {
89
+ "name": "Chris Biggs",
90
+ "party": "Democratic"
91
+ },
92
+ {
93
+ "name": "Kris Kobach",
94
+ "party": "Republican"
95
+ },
96
+ {
97
+ "name": "Phillip Horatio Lucas",
98
+ "party": "Libertarian"
99
+ },
100
+ {
101
+ "name": "Derek Langseth",
102
+ "party": "Reform"
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ "type": "General",
108
+ "office": "U.S. Senate",
109
+ "district": {
110
+ "name": "U.S. Senate",
111
+ "scope": "statewide",
112
+ "id": "5"
113
+ },
114
+ "candidates": [
115
+ {
116
+ "name": "Lisa Johnston",
117
+ "party": "Democratic",
118
+ "candidateUrl": "www.lisaforkansas.com",
119
+ "phone": "913-662-1457",
120
+ "email": "lisa@lisaforkansas.com"
121
+ },
122
+ {
123
+ "name": "Jerry Moran",
124
+ "party": "Republican"
125
+ },
126
+ {
127
+ "name": "Michael Wm. Dann",
128
+ "party": "Libertarian"
129
+ },
130
+ {
131
+ "name": "Joseph (joe) K. Bellis",
132
+ "party": "Reform"
133
+ }
134
+ ],
135
+ "sources": [
136
+ {
137
+ "name": "Voting Information Project",
138
+ "official": true
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ "type": "General",
144
+ "office": "BD of Public Utilities 2"
145
+ },
146
+ {
147
+ "type": "General",
148
+ "office": "Attorney General",
149
+ "candidates": [
150
+ {
151
+ "name": "Steve Six",
152
+ "party": "Democratic"
153
+ },
154
+ {
155
+ "name": "Derek Schmidt",
156
+ "party": "Republican"
157
+ },
158
+ {
159
+ "name": "Dennis Hawver",
160
+ "party": "Libertarian"
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ "type": "General",
166
+ "office": "U.S. Representative 3"
167
+ },
168
+ {
169
+ "type": "General",
170
+ "office": "Governor/Lt. Governor",
171
+ "district": {
172
+ "name": "Governor/Lt. Governor",
173
+ "scope": "statewide",
174
+ "id": "1"
175
+ },
176
+ "candidates": [
177
+ {
178
+ "name": "Andrew P. Gray",
179
+ "party": "Libertarian",
180
+ "email": "chair@lpks.org"
181
+ },
182
+ {
183
+ "name": "Kenneth (ken) W. Cannon",
184
+ "party": "Reform"
185
+ },
186
+ {
187
+ "name": "Tom Holland",
188
+ "party": "Democratic",
189
+ "candidateUrl": "www.tomhollandforkansas.com",
190
+ "email": "info@tomhollandforkansas.com"
191
+ },
192
+ {
193
+ "name": "Sam Brownback",
194
+ "party": "Republican",
195
+ "candidateUrl": "www.brownbackforkansas.com",
196
+ "email": "media@brownback.com"
197
+ }
198
+ ],
199
+ "sources": [
200
+ {
201
+ "name": "Voting Information Project",
202
+ "official": true
203
+ }
204
+ ]
205
+ },
206
+ {
207
+ "type": "General",
208
+ "office": "Commissioner-At-Large 2"
209
+ },
210
+ {
211
+ "type": "General",
212
+ "office": "Kansas Senate 6"
213
+ },
214
+ {
215
+ "type": "General",
216
+ "office": "Clerk"
217
+ },
218
+ {
219
+ "type": "General",
220
+ "office": "President / Vice President"
221
+ },
222
+ {
223
+ "type": "General",
224
+ "office": "Register of Deeds"
225
+ },
226
+ {
227
+ "type": "General",
228
+ "office": "BD of Public Utilities (AL)"
229
+ },
230
+ {
231
+ "type": "General",
232
+ "office": "Commissioner 2"
233
+ },
234
+ {
235
+ "type": "General",
236
+ "office": "USD 500"
237
+ },
238
+ {
239
+ "type": "General",
240
+ "office": "State Board of Education 1"
241
+ },
242
+ {
243
+ "type": "General",
244
+ "office": "Treasurer"
245
+ }
246
+ ],
247
+ "state": [
248
+ {
249
+ "name": "State of Kansas",
250
+ "electionAdministrationBody": {
251
+ "name": "Kansas",
252
+ "electionOfficials": [
253
+ {
254
+ "name": "Brad Bryant",
255
+ "title": "Election Director",
256
+ "officePhoneNumber": "785-296-4561",
257
+ "emailAddress": "cclark@essvote.com"
258
+ }
259
+ ]
260
+ },
261
+ "local_jurisdiction": {
262
+ "name": "Wyandotte",
263
+ "electionAdministrationBody": {
264
+ "name": "Wyandotte",
265
+ "electionInfoUrl": "http://www.wycokck.org/election",
266
+ "electionOfficials": [
267
+ {
268
+ "name": "Bruce Newby",
269
+ "title": "Election Commissioner",
270
+ "officePhoneNumber": "(913) 573-8500",
271
+ "emailAddress": "hbbrooks@essvote.com"
272
+ }
273
+ ]
274
+ },
275
+ "sources": [
276
+ {
277
+ "name": "Voting Information Project",
278
+ "official": true
279
+ }
280
+ ]
281
+ },
282
+ "sources": [
283
+ {
284
+ "name": "Voting Information Project",
285
+ "official": true
286
+ }
287
+ ]
288
+ }
289
+ ]
290
+ }
@@ -0,0 +1,15 @@
1
+ module Fixtures
2
+ def self.load_fixture(kind)
3
+ file_path = File.join(File.dirname(__FILE__), "../fixtures", "#{kind}.json")
4
+
5
+ if File.exists?(file_path)
6
+ File.open(file_path, "rb").read
7
+ else
8
+ raise "Fixture #{file_path} does not exist"
9
+ end
10
+ end
11
+
12
+ def load_fixture(*args)
13
+ Fixtures.load_fixture(*args)
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Requests
2
+ def stub_request_for(fixture, path)
3
+ stub_request(:get, "https://www.googleapis.com/civicinfo/v1/#{path}").to_return(status: 200, body: Fixtures.load_fixture(fixture), headers: {})
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ module Google
2
+ module Civic
3
+ shared_context "a connection to the client" do
4
+ let(:client) { Client.new(api_key, connection) }
5
+ let(:connection) { Connection.new(params) }
6
+ let(:api_key) { "1234567890" }
7
+ let(:params) {
8
+ {
9
+ base_url: Router::BASE_URL
10
+ }
11
+ }
12
+
13
+ before { stub_request_for("elections", "elections?zipcode=#{zipcode}&key=#{api_key}") }
14
+ end
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,195 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google-civic-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Coding ZEAL
8
+ - Adam Cuppy
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-06-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: multi_json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '1.10'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '1.10'
28
+ - !ruby/object:Gem::Dependency
29
+ name: hashie
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: '3.0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: '3.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: faraday
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '0.9'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '0.9'
56
+ - !ruby/object:Gem::Dependency
57
+ name: faraday_middleware
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '0.9'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '0.9'
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '1.3'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: '1.3'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: '2.14'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ version: '2.14'
98
+ - !ruby/object:Gem::Dependency
99
+ name: pry
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: webmock
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ version: '1.18'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '1.18'
126
+ description:
127
+ email:
128
+ - adam@codingzeal.com
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - .gitignore
134
+ - .travis.yml
135
+ - Gemfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - google-civic-ruby.gemspec
140
+ - lib/google-civic.rb
141
+ - lib/google-civic/client.rb
142
+ - lib/google-civic/connection.rb
143
+ - lib/google-civic/election.rb
144
+ - lib/google-civic/elections.rb
145
+ - lib/google-civic/requester.rb
146
+ - lib/google-civic/router.rb
147
+ - lib/google-civic/version.rb
148
+ - spec/google-civic/client_spec.rb
149
+ - spec/google-civic/election_spec.rb
150
+ - spec/google-civic/elections_spec.rb
151
+ - spec/google-civic/requester_spec.rb
152
+ - spec/spec_helper.rb
153
+ - spec/support/fixtures/elections.json
154
+ - spec/support/fixtures/representative_info.json
155
+ - spec/support/fixtures/voter_info.json
156
+ - spec/support/helpers/fixtures.rb
157
+ - spec/support/helpers/requests.rb
158
+ - spec/support/shared_examples/connection_to_the_client.rb
159
+ homepage: https://github.com/CodingZeal/google-civic-ruby
160
+ licenses:
161
+ - MIT
162
+ metadata: {}
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.2.2
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: Ruby wrapper for the Google Civic API
183
+ test_files:
184
+ - spec/google-civic/client_spec.rb
185
+ - spec/google-civic/election_spec.rb
186
+ - spec/google-civic/elections_spec.rb
187
+ - spec/google-civic/requester_spec.rb
188
+ - spec/spec_helper.rb
189
+ - spec/support/fixtures/elections.json
190
+ - spec/support/fixtures/representative_info.json
191
+ - spec/support/fixtures/voter_info.json
192
+ - spec/support/helpers/fixtures.rb
193
+ - spec/support/helpers/requests.rb
194
+ - spec/support/shared_examples/connection_to_the_client.rb
195
+ has_rdoc: