get_your_rep 1.0.3 → 1.0.4
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fe38bde07d4ade3dfcb86928ca140ed53b6761e
|
4
|
+
data.tar.gz: 6eedfe6c5b68af6e447c9d7b4b6221e531e31853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de3a833357b414447dc44002dc3260c61808661a9a11ffd2bc52d62f92286113711b133d9b13617af80ef724432df9897a00fa0b8e2f24217707d59116870c02
|
7
|
+
data.tar.gz: a14e284a91c1ad1bee2ebf5771df47d58e6bccf6fb2cbc9edae7f0c9fcf0ae22214d6fc1212b12abb811148a05bb6115a65ad05562ad1ecdc00b6c8e96f4bad8
|
data/lib/get_your_rep/cli.rb
CHANGED
@@ -59,9 +59,9 @@ module GetYourRep
|
|
59
59
|
puts "'address'................displays address or sets it if there is none".bold.blue
|
60
60
|
puts "'set address'............set a new address".bold.blue
|
61
61
|
puts "'all reps'...............get federal legislators from Google".bold.blue
|
62
|
-
puts
|
62
|
+
puts ' and state legislators from Open States'.bold.blue
|
63
63
|
puts "'google all reps'........get all federal and state executives and".bold.blue
|
64
|
-
puts
|
64
|
+
puts ' legislators from Google'.bold.blue
|
65
65
|
puts "'google congress only'...get only congress from Google".bold.blue
|
66
66
|
puts "'open states'............get only state legislators from Open States".bold.blue
|
67
67
|
end
|
@@ -19,7 +19,7 @@ module GetYourRep
|
|
19
19
|
def all_reps(address)
|
20
20
|
self.coordinates = address.is_a?(Array) ? address : get_coordinates(address)
|
21
21
|
self.response = find_rep
|
22
|
-
if response
|
22
|
+
if !response || response.is_a?(String) || response.first['error']
|
23
23
|
handle_reps_not_found_error
|
24
24
|
else
|
25
25
|
parse_reps
|
@@ -31,12 +31,11 @@ module GetYourRep
|
|
31
31
|
|
32
32
|
# Sets parameters for and executes Open States API request.
|
33
33
|
def find_rep
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
34
|
+
return unless coordinates
|
35
|
+
lat = coordinates.first
|
36
|
+
long = coordinates.last
|
37
|
+
url = "http://openstates.org/api/v1/legislators/geo/?lat=#{lat}&long=#{long}"
|
38
|
+
HTTParty.get(url).parsed_response
|
40
39
|
end
|
41
40
|
|
42
41
|
# Parses the JSON response and assembles it into a Delegation object.
|
@@ -18,8 +18,8 @@ module GetYourRep
|
|
18
18
|
{ name: full_name.split(', ').reverse.join(' '),
|
19
19
|
office: office,
|
20
20
|
party: party,
|
21
|
-
phones: phones - [nil],
|
22
21
|
office_locations: office_locations,
|
22
|
+
phones: phones - [nil],
|
23
23
|
email: email - [nil],
|
24
24
|
url: url,
|
25
25
|
photo: photo_url,
|
data/lib/get_your_rep/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: get_your_rep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- msimonborg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|