google-civic 0.0.1 → 0.0.2

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTA0YmFhNjVjZjcwMGI0NTBhMmNkMDMyYWI3MGU3YmIxMmMyM2JhZg==
5
+ data.tar.gz: !binary |-
6
+ NTlkNDY4ODYxNzYzZjE4YjhkN2VkMzM0ODM2OTljMmY2NjE3Yjc1OQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzJiOWMwODdiZDliNTlmZTY1OTAxNDU3Njc5Y2E3YmQxZTIwMGUyM2ViMDMy
10
+ ZTc4MDk5NTQ3MWFkMTQxMGQ1NzJhOGY5YTc5NWU2NTY3Y2ViYTAyZjliZjQy
11
+ YmVjZDhkNmVhNGQ4MjhiOGMwZGViMDg3ZjE3NTJlNzgxZTllOTc=
12
+ data.tar.gz: !binary |-
13
+ NThkNjc5NDJjOWIwMTAwOTQyZGNmNmI3NzE0NjE2MDc1ZmIwYzQ1OTNiYzQw
14
+ YzRkZGUwNmRiNTQwZjA4ZThlYzQ3NjYwMmFkNjY4MDk1ODdjY2FjYjQwOGZi
15
+ ZDJjZGM5MmM1YmNkMTlkMWQwYWQ0YTdlMzMxZWE5Mzg0ZDUyNzY=
@@ -3,7 +3,5 @@ matrix:
3
3
  allow_failures:
4
4
  - rvm: ruby-head
5
5
  rvm:
6
- - rbx-19mode
7
- - 1.9.2
8
6
  - 1.9.3
9
- - ruby-head
7
+ - 2.0.0
@@ -5,8 +5,8 @@ Gem::Specification.new do |gem|
5
5
  gem.add_dependency 'addressable', '~> 2.2'
6
6
  gem.add_dependency 'faraday', '~> 0.8'
7
7
  gem.add_dependency 'faraday_middleware', '~> 0.8'
8
- gem.add_dependency 'hashie', '~> 1.2'
9
- gem.add_dependency 'multi_json', '~> 1.3'
8
+ gem.add_dependency 'hashie', '~> 2.0'
9
+ gem.add_dependency 'multi_json', '~> 1.8'
10
10
  gem.add_development_dependency 'rake'
11
11
  gem.add_development_dependency 'rdiscount'
12
12
  gem.add_development_dependency 'rspec'
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
20
20
  gem.files = `git ls-files`.split("\n")
21
21
  gem.homepage = ''
22
+ gem.license = 'MIT'
22
23
  gem.name = 'google-civic'
23
24
  gem.require_paths = ['lib']
24
25
  gem.summary = gem.description
@@ -30,7 +30,19 @@ module GoogleCivic
30
30
  # @example List information around the voter
31
31
  # GoogleCivic.voter_info(200, '1263 Pacific Ave. Kansas City KS')
32
32
  def voter_info(election_id, address, options={})
33
- post("voterinfo/#{election_id}/lookup", options.merge({:address => address}))
33
+ post("voterinfo/#{election_id}/lookup", {address: address}, options)
34
+ end
35
+
36
+ # Looks up political geography and (optionally) representative information based on an address
37
+ #
38
+ # @param address [String] The address to search on.
39
+ # @param options [Hash] A customizable set of options.
40
+ # @return [Hashie::Mash] A list of current information about representatives
41
+ # @see https://developers.google.com/civic-information/docs/us_v1/representatives/representativeInfoQuery
42
+ # @example List information about the representatives
43
+ # GoogleCivic.representative_info('1263 Pacific Ave. Kansas City KS')
44
+ def representative_info(address, options={})
45
+ post("representatives/lookup", {address: address}, options)
34
46
  end
35
47
 
36
48
  end
@@ -5,13 +5,10 @@ module GoogleCivic
5
5
  module Connection
6
6
  private
7
7
 
8
- def connection(json, options={})
8
+ def connection(options={})
9
9
  connection = Faraday.new(options.merge({:url => 'https://www.googleapis.com/civicinfo/us_v1/'})) do |builder|
10
- if json
11
- builder.request :json
12
- else
13
- builder.request :url_encoded
14
- end
10
+ builder.request :json
11
+ builder.request :url_encoded
15
12
  builder.use FaradayMiddleware::Mashify
16
13
  builder.use FaradayMiddleware::ParseJson
17
14
  builder.adapter Faraday.default_adapter
@@ -2,22 +2,20 @@ require 'multi_json'
2
2
 
3
3
  module GoogleCivic
4
4
  module Request
5
- def get(path, options={})
6
- request(:get, path, json=false,options)
5
+ def get(path,options={})
6
+ request(:get, path, body=nil, options)
7
7
  end
8
8
 
9
- def post(path, options={})
10
- request(:post, path, json=true,options)
9
+ def post(path, body, options={})
10
+ request(:post, path, body, options)
11
11
  end
12
12
 
13
13
  private
14
14
 
15
- def request(method, path, json,options)
16
- response = connection(json).send(method) do |request|
15
+ def request(method, path, body, options)
16
+ response = connection.send(method) do |request|
17
17
  request.url(path, options.merge(:key => @key))
18
- if json
19
- request.body = options.to_json
20
- end
18
+ request.body = body.to_json
21
19
  end
22
20
  response.body
23
21
  end
@@ -1,3 +1,3 @@
1
1
  module GoogleCivic
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,767 @@
1
+ {
2
+ "kind": "civicinfo#representativeInfoResponse",
3
+ "status": "success",
4
+ "normalizedInput": {
5
+ "line1": "1263 pacific ave",
6
+ "city": "kansas city",
7
+ "state": "KS",
8
+ "zip": "66102"
9
+ },
10
+ "divisions": {
11
+ "ocd-division/country:us/state:ks/county:wyandotte/council_district:2": {
12
+ "name": "Wyandotte County Commissioner District 2",
13
+ "scope": "countyCouncil"
14
+ },
15
+ "ocd-division/country:us/state:ks/cd:3": {
16
+ "name": "Kansas's 3rd congressional district",
17
+ "scope": "congressional",
18
+ "officeIds": [
19
+ "O0"
20
+ ]
21
+ },
22
+ "ocd-division/country:us/state:ks/sldl:32": {
23
+ "name": "Kansas House of Representatives district 32",
24
+ "scope": "stateLower",
25
+ "officeIds": [
26
+ "O1"
27
+ ]
28
+ },
29
+ "ocd-division/country:us/state:ks/place:kansas_city": {
30
+ "name": "Kansas City city",
31
+ "scope": "citywide",
32
+ "officeIds": [
33
+ "O2",
34
+ "O3",
35
+ "O4",
36
+ "O5",
37
+ "O6",
38
+ "O7",
39
+ "O8"
40
+ ]
41
+ },
42
+ "ocd-division/country:us/state:ks/county:wyandotte": {
43
+ "name": "Wyandotte County",
44
+ "scope": "countywide"
45
+ },
46
+ "ocd-division/country:us": {
47
+ "name": "United States",
48
+ "scope": "national",
49
+ "officeIds": [
50
+ "O9",
51
+ "Oa"
52
+ ]
53
+ },
54
+ "ocd-division/country:us/state:ks": {
55
+ "name": "Kansas",
56
+ "scope": "statewide",
57
+ "officeIds": [
58
+ "Ob",
59
+ "Oc",
60
+ "Od",
61
+ "Oe",
62
+ "Of",
63
+ "O10",
64
+ "O11"
65
+ ]
66
+ },
67
+ "ocd-division/country:us/state:ks/sldu:6": {
68
+ "name": "Kansas State Senate district 6",
69
+ "scope": "stateUpper",
70
+ "officeIds": [
71
+ "O12"
72
+ ]
73
+ }
74
+ },
75
+ "offices": {
76
+ "O0": {
77
+ "name": "United States House of Representatives KS-03",
78
+ "level": "federal",
79
+ "officialIds": [
80
+ "P0"
81
+ ]
82
+ },
83
+ "O1": {
84
+ "name": "KS State House District 32",
85
+ "level": "state",
86
+ "officialIds": [
87
+ "P1"
88
+ ]
89
+ },
90
+ "O2": {
91
+ "name": "Sheriff",
92
+ "level": "county",
93
+ "officialIds": [
94
+ "P2"
95
+ ]
96
+ },
97
+ "O3": {
98
+ "name": "District Attorney",
99
+ "level": "county",
100
+ "officialIds": [
101
+ "P3"
102
+ ]
103
+ },
104
+ "O4": {
105
+ "name": "Register of Deeds",
106
+ "level": "county",
107
+ "officialIds": [
108
+ "P4"
109
+ ]
110
+ },
111
+ "O5": {
112
+ "name": "Director of Revenue",
113
+ "level": "county",
114
+ "officialIds": [
115
+ "P5"
116
+ ]
117
+ },
118
+ "O6": {
119
+ "name": "Unified Government Clerk",
120
+ "level": "county",
121
+ "officialIds": [
122
+ "P6"
123
+ ]
124
+ },
125
+ "O7": {
126
+ "name": "Unified Government Commission, At Large, District 1",
127
+ "level": "county",
128
+ "officialIds": [
129
+ "P7"
130
+ ]
131
+ },
132
+ "O8": {
133
+ "name": "Unified Government Commission, At Large, District 2",
134
+ "level": "county",
135
+ "officialIds": [
136
+ "P8"
137
+ ]
138
+ },
139
+ "O9": {
140
+ "name": "President",
141
+ "level": "federal",
142
+ "officialIds": [
143
+ "P9"
144
+ ]
145
+ },
146
+ "Oa": {
147
+ "name": "Vice President",
148
+ "level": "federal",
149
+ "officialIds": [
150
+ "P10"
151
+ ]
152
+ },
153
+ "Ob": {
154
+ "name": "Governor",
155
+ "level": "state",
156
+ "officialIds": [
157
+ "P11"
158
+ ]
159
+ },
160
+ "Oc": {
161
+ "name": "State Treasurer",
162
+ "level": "state",
163
+ "officialIds": [
164
+ "P12"
165
+ ]
166
+ },
167
+ "Od": {
168
+ "name": "Attorney General",
169
+ "level": "state",
170
+ "officialIds": [
171
+ "P13"
172
+ ]
173
+ },
174
+ "Oe": {
175
+ "name": "Secretary of State",
176
+ "level": "state",
177
+ "officialIds": [
178
+ "P14"
179
+ ]
180
+ },
181
+ "Of": {
182
+ "name": "Lieutenant Governor",
183
+ "level": "state",
184
+ "officialIds": [
185
+ "P15"
186
+ ]
187
+ },
188
+ "O10": {
189
+ "name": "United States Senate",
190
+ "level": "federal",
191
+ "officialIds": [
192
+ "P16",
193
+ "P17"
194
+ ]
195
+ },
196
+ "O11": {
197
+ "name": "Insurance Commissioner",
198
+ "level": "state",
199
+ "officialIds": [
200
+ "P18"
201
+ ]
202
+ },
203
+ "O12": {
204
+ "name": "KS State Senate District 6",
205
+ "level": "state",
206
+ "officialIds": [
207
+ "P19"
208
+ ]
209
+ }
210
+ },
211
+ "officials": {
212
+ "P0": {
213
+ "name": "Kevin Yoder",
214
+ "address": [
215
+ {
216
+ "line1": "215 Cannon HOB",
217
+ "city": "washington",
218
+ "state": "DC",
219
+ "zip": "20515"
220
+ }
221
+ ],
222
+ "party": "Republican",
223
+ "phones": [
224
+ "(202) 225-2865"
225
+ ],
226
+ "urls": [
227
+ "http://yoder.house.gov/"
228
+ ],
229
+ "photoUrl": "http://yoder.house.gov/images/user_images/headshot.jpg",
230
+ "channels": [
231
+ {
232
+ "type": "Facebook",
233
+ "id": "CongressmanKevinYoder"
234
+ },
235
+ {
236
+ "type": "Twitter",
237
+ "id": "RepKevinYoder"
238
+ }
239
+ ]
240
+ },
241
+ "P1": {
242
+ "name": "Mike Peterson",
243
+ "address": [
244
+ {
245
+ "line1": "450 North 17th",
246
+ "city": "kansas city",
247
+ "state": "KS",
248
+ "zip": "66102"
249
+ }
250
+ ],
251
+ "party": "Democratic",
252
+ "phones": [
253
+ "(785) 296-7371"
254
+ ],
255
+ "photoUrl": "http://www.kslegislature.org/li/m/images/pics/rep_peterson_michael_1.jpg",
256
+ "emails": [
257
+ "michael.peterson@house.ks.gov"
258
+ ]
259
+ },
260
+ "P2": {
261
+ "name": "Donald Ash",
262
+ "address": [
263
+ {
264
+ "line1": "701 Nth 7th Street Suite 20",
265
+ "city": "kansas city",
266
+ "state": "KS",
267
+ "zip": "66101"
268
+ }
269
+ ],
270
+ "party": "Democratic",
271
+ "phones": [
272
+ "(913) 573-2861"
273
+ ],
274
+ "urls": [
275
+ "http://www.wycokck.org/DefaultDept32.aspx?id=2614"
276
+ ],
277
+ "emails": [
278
+ "dash@wycokck.org"
279
+ ]
280
+ },
281
+ "P3": {
282
+ "name": "Jerome Gorman",
283
+ "address": [
284
+ {
285
+ "line1": "701 Nth 7th Street Suite 10",
286
+ "city": "kansas city",
287
+ "state": "KS",
288
+ "zip": "66101"
289
+ }
290
+ ],
291
+ "party": "Democratic",
292
+ "phones": [
293
+ "(913) 573-2851"
294
+ ],
295
+ "urls": [
296
+ "http://www.wycokck.org/Internet2010DistAttyBanner.aspx?id=176&banner=6912&menu_id=946"
297
+ ]
298
+ },
299
+ "P4": {
300
+ "name": "Nancy Burns",
301
+ "address": [
302
+ {
303
+ "line1": "710 n. 7th street",
304
+ "city": "kansas city",
305
+ "state": "KS",
306
+ "zip": "66101"
307
+ }
308
+ ],
309
+ "party": "Unknown",
310
+ "phones": [
311
+ "(913) 573-2841"
312
+ ],
313
+ "urls": [
314
+ "http://www.wycokck.org/Internetdept.aspx?id=2600&menu_id=1024&banner=15284"
315
+ ],
316
+ "emails": [
317
+ "nburns@wycokck.org"
318
+ ]
319
+ },
320
+ "P5": {
321
+ "name": "Debbie Pack",
322
+ "address": [
323
+ {
324
+ "line1": "710 n. 7th street",
325
+ "city": "kansas city",
326
+ "state": "KS",
327
+ "zip": "66101"
328
+ }
329
+ ],
330
+ "party": "Unknown",
331
+ "phones": [
332
+ "(913) 573-2821"
333
+ ],
334
+ "urls": [
335
+ "http://www.wycokck.org/treasury/"
336
+ ],
337
+ "emails": [
338
+ "dpack@wycokck.org"
339
+ ]
340
+ },
341
+ "P6": {
342
+ "name": "Bridgette D. Cobbins",
343
+ "address": [
344
+ {
345
+ "line1": "710 n. 7th street",
346
+ "city": "kansas city",
347
+ "state": "KS",
348
+ "zip": "66101"
349
+ }
350
+ ],
351
+ "party": "Unknown",
352
+ "phones": [
353
+ "(913) 573-5260"
354
+ ],
355
+ "urls": [
356
+ "http://www.wycokck.org/InternetDept.aspx?id=18992&menu_id=554&terms=Bridgette%20Cobbins"
357
+ ],
358
+ "emails": [
359
+ "clerkwest@wycokck.org"
360
+ ]
361
+ },
362
+ "P7": {
363
+ "name": "Vacant",
364
+ "address": [
365
+ {
366
+ "line1": "701 Nth 7th Street Suite 979",
367
+ "city": "kansas city",
368
+ "state": "KS",
369
+ "zip": "66101"
370
+ }
371
+ ],
372
+ "party": "Unknown",
373
+ "phones": [
374
+ "(913) 573-5040"
375
+ ],
376
+ "urls": [
377
+ "http://www.wycokck.org/InternetDept.aspx?id=5750&menu_id=1278&banner=15284"
378
+ ],
379
+ "channels": [
380
+ {
381
+ "type": "Facebook",
382
+ "id": "cityofkck"
383
+ },
384
+ {
385
+ "type": "Twitter",
386
+ "id": "CityofKCK"
387
+ }
388
+ ]
389
+ },
390
+ "P8": {
391
+ "name": "John Mendez",
392
+ "address": [
393
+ {
394
+ "line1": "701 Nth 7th Street Suite 979",
395
+ "city": "kansas city",
396
+ "state": "KS",
397
+ "zip": "66101"
398
+ }
399
+ ],
400
+ "party": "Unknown",
401
+ "phones": [
402
+ "(913) 573-5040"
403
+ ],
404
+ "urls": [
405
+ "http://www.wycokck.org/Internetdept.aspx?id=5752&menu_id=1278&banner=15284"
406
+ ],
407
+ "emails": [
408
+ "jmendez@wycokck.org"
409
+ ],
410
+ "channels": [
411
+ {
412
+ "type": "Facebook",
413
+ "id": "cityofkck"
414
+ },
415
+ {
416
+ "type": "Twitter",
417
+ "id": "CityofKCK"
418
+ }
419
+ ]
420
+ },
421
+ "P9": {
422
+ "name": "Barack Hussein Obama II",
423
+ "address": [
424
+ {
425
+ "line1": "The White House",
426
+ "line2": "1600 Pennsylvania Avenue NW",
427
+ "line3": "",
428
+ "city": "Washington",
429
+ "state": "DC",
430
+ "zip": "20500"
431
+ }
432
+ ],
433
+ "party": "Democrat",
434
+ "phones": [
435
+ "(202) 456-1111",
436
+ "(202) 456-1414"
437
+ ],
438
+ "urls": [
439
+ "http://www.whitehouse.gov/administration/president_obama/",
440
+ "http://www.barackobama.com/index.php"
441
+ ],
442
+ "photoUrl": "http://www.whitehouse.gov/sites/default/files/imagecache/admin_official_lowres/administration-official/ao_image/president_official_portrait_hires.jpg",
443
+ "channels": [
444
+ {
445
+ "type": "GooglePlus",
446
+ "id": "110031535020051778989"
447
+ },
448
+ {
449
+ "type": "YouTube",
450
+ "id": "barackobama"
451
+ },
452
+ {
453
+ "type": "Twitter",
454
+ "id": "barackobama"
455
+ },
456
+ {
457
+ "type": "Facebook",
458
+ "id": "barackobama"
459
+ }
460
+ ]
461
+ },
462
+ "P10": {
463
+ "name": "Joseph (Joe) Robinette Biden Jr.",
464
+ "address": [
465
+ {
466
+ "line1": "The White House",
467
+ "line2": "1600 Pennsylvania Avenue NW",
468
+ "line3": "",
469
+ "city": "Washington",
470
+ "state": "DC",
471
+ "zip": "20500"
472
+ }
473
+ ],
474
+ "party": "Democrat",
475
+ "urls": [
476
+ "http://www.whitehouse.gov/administration/vice-president-biden"
477
+ ],
478
+ "photoUrl": "http://www.whitehouse.gov/sites/default/files/imagecache/admin_official_lowres/administration-official/ao_image/vp_portrait.jpeg",
479
+ "channels": [
480
+ {
481
+ "type": "Twitter",
482
+ "id": "JoeBiden"
483
+ },
484
+ {
485
+ "type": "Facebook",
486
+ "id": "joebiden"
487
+ },
488
+ {
489
+ "type": "Twitter",
490
+ "id": "VP"
491
+ }
492
+ ]
493
+ },
494
+ "P11": {
495
+ "name": "Sam Brownback",
496
+ "address": [
497
+ {
498
+ "line1": "Capitol",
499
+ "line2": "300 sw 10th ave.",
500
+ "city": "topeka",
501
+ "state": "KS",
502
+ "zip": "66612"
503
+ }
504
+ ],
505
+ "phones": [
506
+ "(785) 296-3232"
507
+ ],
508
+ "urls": [
509
+ "http://www.governor.ks.gov/"
510
+ ],
511
+ "channels": [
512
+ {
513
+ "type": "Facebook",
514
+ "id": "govsambrownback"
515
+ },
516
+ {
517
+ "type": "Twitter",
518
+ "id": "govsambrownback"
519
+ }
520
+ ]
521
+ },
522
+ "P12": {
523
+ "name": "Ron Estes",
524
+ "address": [
525
+ {
526
+ "line1": "Kansas State Treasurer 900 SW Jackson",
527
+ "line2": "Suite 201",
528
+ "city": "topeka",
529
+ "state": "KS",
530
+ "zip": "66612"
531
+ }
532
+ ],
533
+ "phones": [
534
+ "(785) 296-3171"
535
+ ],
536
+ "urls": [
537
+ "http://www.kansasstatetreasurer.com/prodweb/main/index.php"
538
+ ],
539
+ "emails": [
540
+ "ron@treasurer.ks.gov"
541
+ ],
542
+ "channels": [
543
+ {
544
+ "type": "Facebook",
545
+ "id": "130975650300043"
546
+ },
547
+ {
548
+ "type": "Twitter",
549
+ "id": "RonEstesKS"
550
+ }
551
+ ]
552
+ },
553
+ "P13": {
554
+ "name": "Derek Schmidt",
555
+ "address": [
556
+ {
557
+ "line1": "120 SW 10th Ave",
558
+ "line2": "2nd Floor",
559
+ "city": "topeka",
560
+ "state": "KS",
561
+ "zip": "66612"
562
+ }
563
+ ],
564
+ "phones": [
565
+ "(785) 296-2215"
566
+ ],
567
+ "urls": [
568
+ "http://ag.ks.gov/"
569
+ ],
570
+ "channels": [
571
+ {
572
+ "type": "Twitter",
573
+ "id": "KSAGOffice"
574
+ }
575
+ ]
576
+ },
577
+ "P14": {
578
+ "name": "Kris Kobach",
579
+ "address": [
580
+ {
581
+ "line1": "Kansas Secretary of State Memorial Hall",
582
+ "line2": "1st Floor",
583
+ "line3": "120 sw 10th avenue",
584
+ "city": "topeka",
585
+ "state": "KS",
586
+ "zip": "66612"
587
+ }
588
+ ],
589
+ "phones": [
590
+ "(785) 296-4564"
591
+ ],
592
+ "urls": [
593
+ "http://www.kssos.org/"
594
+ ],
595
+ "emails": [
596
+ "kssos@sos.ks.gov"
597
+ ],
598
+ "channels": [
599
+ {
600
+ "type": "Facebook",
601
+ "id": "Kansas-Secretary-of-State"
602
+ },
603
+ {
604
+ "type": "Twitter",
605
+ "id": "kansassos"
606
+ }
607
+ ]
608
+ },
609
+ "P15": {
610
+ "name": "Jeff Coyler",
611
+ "address": [
612
+ {
613
+ "line1": "State Capitol",
614
+ "line2": "2nd Floor",
615
+ "line3": "300 sw 10th ave.",
616
+ "city": "topeka",
617
+ "state": "KS",
618
+ "zip": "66612"
619
+ }
620
+ ],
621
+ "phones": [
622
+ "(785) 296-2214"
623
+ ],
624
+ "urls": [
625
+ "https://governor.ks.gov/about-the-office/lt-govenor-jeff-colyer"
626
+ ]
627
+ },
628
+ "P16": {
629
+ "name": "Jerry Moran",
630
+ "address": [
631
+ {
632
+ "line1": "361A Russell Senate Office Building",
633
+ "city": "washington",
634
+ "state": "DC",
635
+ "zip": "20510"
636
+ }
637
+ ],
638
+ "party": "Republican",
639
+ "phones": [
640
+ "(202) 224-6521"
641
+ ],
642
+ "urls": [
643
+ "http://www.moran.senate.gov/public/"
644
+ ],
645
+ "photoUrl": "http://moran.senate.gov/public/index.cfm/files/serve?File_id=cd666b47-46e3-4a48-bcf1-ea2890f99817",
646
+ "channels": [
647
+ {
648
+ "type": "Facebook",
649
+ "id": "jerrymoran"
650
+ },
651
+ {
652
+ "type": "Twitter",
653
+ "id": "JerryMoran"
654
+ },
655
+ {
656
+ "type": "YouTube",
657
+ "id": "senatorjerrymoran"
658
+ }
659
+ ]
660
+ },
661
+ "P17": {
662
+ "name": "Pat Roberts",
663
+ "address": [
664
+ {
665
+ "line1": "109 Hart Senate Office Building",
666
+ "city": "washington",
667
+ "state": "DC",
668
+ "zip": "20510"
669
+ }
670
+ ],
671
+ "party": "Republican",
672
+ "phones": [
673
+ "(202) 224-4774"
674
+ ],
675
+ "urls": [
676
+ "http://www.roberts.senate.gov/public/"
677
+ ],
678
+ "photoUrl": "http://roberts.senate.gov/public/index.cfm?a=Files.Serve&File_id=b42c6b05-966e-48ea-b3ed-9e5fc4ab1a0d",
679
+ "emails": [
680
+ "pat_roberts@roberts.senate.gov"
681
+ ],
682
+ "channels": [
683
+ {
684
+ "type": "Facebook",
685
+ "id": "SenPatRoberts"
686
+ },
687
+ {
688
+ "type": "Twitter",
689
+ "id": "SenPatRoberts"
690
+ },
691
+ {
692
+ "type": "YouTube",
693
+ "id": "SenPatRoberts"
694
+ }
695
+ ]
696
+ },
697
+ "P18": {
698
+ "name": "Sandy Praeger",
699
+ "address": [
700
+ {
701
+ "line1": "420 sw 9th street",
702
+ "city": "topeka",
703
+ "state": "KS",
704
+ "zip": "66612"
705
+ }
706
+ ],
707
+ "phones": [
708
+ "(785) 296-3071"
709
+ ],
710
+ "urls": [
711
+ "http://www.ksinsurance.org/"
712
+ ],
713
+ "emails": [
714
+ "commissioner@ksinsurance.org"
715
+ ],
716
+ "channels": [
717
+ {
718
+ "type": "Facebook",
719
+ "id": "KansasInsuranceDepartment"
720
+ }
721
+ ]
722
+ },
723
+ "P19": {
724
+ "name": "Pat Pettey",
725
+ "address": [
726
+ {
727
+ "line1": "Kansas State Capitol",
728
+ "line2": "300 SW 10th St.",
729
+ "line3": "Room 125-E",
730
+ "city": "Topeka",
731
+ "state": "KS",
732
+ "zip": "66612-1504"
733
+ },
734
+ {
735
+ "line1": "5316 Lakewood Street",
736
+ "line2": "",
737
+ "line3": "",
738
+ "city": "Kansas City",
739
+ "state": "KS",
740
+ "zip": "66106"
741
+ }
742
+ ],
743
+ "party": "Democratic",
744
+ "phones": [
745
+ "(785) 296-7375"
746
+ ],
747
+ "urls": [
748
+ "http://www.kslegislature.org/li/b2013_14/members/sen_pettey_pat_1/",
749
+ "http://www.kssenatedems.org/district-6/"
750
+ ],
751
+ "photoUrl": "http://www.kslegislature.org/li/m/images/pics/sen_pettey_pat_1.jpg",
752
+ "emails": [
753
+ "Pat.Pettey@senate.ks.gov"
754
+ ],
755
+ "channels": [
756
+ {
757
+ "type": "Twitter",
758
+ "id": "PatHPettey"
759
+ },
760
+ {
761
+ "type": "Facebook",
762
+ "id": "PetteyForSenate"
763
+ }
764
+ ]
765
+ }
766
+ }
767
+ }
@@ -19,18 +19,35 @@ describe GoogleCivic::Client do
19
19
  stub_get("/elections?key=abc123").
20
20
  to_return(:status => 200, :body => fixture("elections.json"), :headers => {})
21
21
  elections = @client.elections
22
- elections.first.should == ["kind", "civicinfo#electionsqueryresponse"]
22
+ elections.first.should eql ["kind", "civicinfo#electionsqueryresponse"]
23
23
  end
24
24
  end
25
25
 
26
26
  describe "#voter_info" do
27
27
  it "should return the voter information from an address" do
28
- stub_post("/voterinfo/2000/lookup?address=1263%20Pacific%20Ave.%20Kansas%20City%20KS&key=abc123").
29
- with(:body => "{\"address\":\"1263 Pacific Ave. Kansas City KS\"}",
30
- :headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
31
- to_return(:status => 200, :body => fixture("voter_info.json"), :headers => {})
28
+ stub_post("/voterinfo/2000/lookup?key=abc123").
29
+ with(:body => "{\"address\":\"1263 Pacific Ave. Kansas City KS\"}").
30
+ to_return(:status => 200, :body => fixture("voter_info.json"), :headers => {})
32
31
  voter_info = @client.voter_info(2000, "1263 Pacific Ave. Kansas City KS")
33
- voter_info.election.name.should == "VIP Test Election"
32
+ voter_info.election.name.should eql "VIP Test Election"
33
+ end
34
+
35
+ it "should take a query parameter" do
36
+ stub_post("/voterinfo/2000/lookup?includeOffices=true&key=abc123").
37
+ with(:body => "{\"address\":\"1263 Pacific Ave. Kansas City KS\"}").
38
+ to_return(:status => 200, :body => fixture("voter_info.json"), :headers => {})
39
+ voter_info = @client.voter_info(2000, "1263 Pacific Ave. Kansas City KS", {includeOffices: true})
40
+ voter_info.election.name.should eql "VIP Test Election"
41
+ end
42
+ end
43
+
44
+ describe "#representative_info" do
45
+ it "should return the representative information from an address" do
46
+ stub_post("/representatives/lookup?key=abc123").
47
+ with(:body => "{\"address\":\"1263 Pacific Ave. Kansas City KS\"}").
48
+ to_return(:status => 200, :body => fixture("representative.json"), :headers => {})
49
+ rep_info = @client.representative_info("1263 Pacific Ave. Kansas City KS")
50
+ rep_info.offices.first[1].name.should eql "United States House of Representatives KS-03"
34
51
  end
35
52
  end
36
53
 
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-civic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ryan Resella
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-28 00:00:00.000000000 Z
11
+ date: 2013-12-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: addressable
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: faraday
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: faraday_middleware
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,39 +55,34 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: hashie
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
69
- version: '1.2'
61
+ version: '2.0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
77
- version: '1.2'
68
+ version: '2.0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: multi_json
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
85
- version: '1.3'
75
+ version: '1.8'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
93
- version: '1.3'
82
+ version: '1.8'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: rdiscount
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: rspec
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: simplecov
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ! '>='
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ! '>='
156
137
  - !ruby/object:Gem::Version
@@ -158,7 +139,6 @@ dependencies:
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: webmock
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
143
  - - ! '>='
164
144
  - !ruby/object:Gem::Version
@@ -166,7 +146,6 @@ dependencies:
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
150
  - - ! '>='
172
151
  - !ruby/object:Gem::Version
@@ -174,7 +153,6 @@ dependencies:
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: yard
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
157
  - - ! '>='
180
158
  - !ruby/object:Gem::Version
@@ -182,7 +160,6 @@ dependencies:
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
164
  - - ! '>='
188
165
  - !ruby/object:Gem::Version
@@ -209,36 +186,38 @@ files:
209
186
  - lib/google-civic/request.rb
210
187
  - lib/google-civic/version.rb
211
188
  - spec/fixtures/elections.json
189
+ - spec/fixtures/representative.json
212
190
  - spec/fixtures/voter_info.json
213
191
  - spec/google-civic/client_spec.rb
214
192
  - spec/google-civic_spec.rb
215
193
  - spec/helper.rb
216
194
  homepage: ''
217
- licenses: []
195
+ licenses:
196
+ - MIT
197
+ metadata: {}
218
198
  post_install_message:
219
199
  rdoc_options: []
220
200
  require_paths:
221
201
  - lib
222
202
  required_ruby_version: !ruby/object:Gem::Requirement
223
- none: false
224
203
  requirements:
225
204
  - - ! '>='
226
205
  - !ruby/object:Gem::Version
227
206
  version: '0'
228
207
  required_rubygems_version: !ruby/object:Gem::Requirement
229
- none: false
230
208
  requirements:
231
209
  - - ! '>='
232
210
  - !ruby/object:Gem::Version
233
211
  version: '0'
234
212
  requirements: []
235
213
  rubyforge_project:
236
- rubygems_version: 1.8.24
214
+ rubygems_version: 2.1.10
237
215
  signing_key:
238
- specification_version: 3
216
+ specification_version: 4
239
217
  summary: A Ruby wrapper for the Google Civic API
240
218
  test_files:
241
219
  - spec/fixtures/elections.json
220
+ - spec/fixtures/representative.json
242
221
  - spec/fixtures/voter_info.json
243
222
  - spec/google-civic/client_spec.rb
244
223
  - spec/google-civic_spec.rb