get_your_rep 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/get_your_rep/google.rb +14 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f38b5373ce38e6de289e60a8548ee29d75c5a25
|
4
|
+
data.tar.gz: 3e00ec4aae39f8731e6a798eae047cb4b9ce0d3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3301d1ea4add95e1d7d2647d93663ae8cd07347768b8a8c3b04d2cb1699575de252845b740ec72b3931c1254eb7e69f19ef4a6cc9e2794ea389e68ef8411137c
|
7
|
+
data.tar.gz: 3b964af288d448ac939bc86437104cd9abaaa967cefae3c17a9688c88f648f6d017dff312fe67c4d434d146b6d3618efd7498579e9d0ff57cc4bce50d3456936
|
data/lib/get_your_rep/google.rb
CHANGED
@@ -147,7 +147,7 @@ module GetYourRep
|
|
147
147
|
:name, official['name'],
|
148
148
|
:office, @response['offices'].first['name'],
|
149
149
|
:party, official['party'],
|
150
|
-
:phone, official['phones'],
|
150
|
+
:phone, official['phones'] || [],
|
151
151
|
:office_locations, offices(official),
|
152
152
|
:email, official['emails'] || [],
|
153
153
|
:url, (official['urls'].first if official['urls']),
|
@@ -160,19 +160,21 @@ module GetYourRep
|
|
160
160
|
def self.offices(official)
|
161
161
|
offices = []
|
162
162
|
|
163
|
-
official['address']
|
164
|
-
|
163
|
+
if official['address']
|
164
|
+
official['address'].each do |office|
|
165
|
+
office_hash = {}
|
165
166
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
if office['line1'].downcase.match(/(state|house|senate|assembly|capitol|dirksen|reyburn|rayburn|legislative|legislature|government)+/)
|
168
|
+
office_hash[:type] = 'capitol'
|
169
|
+
else
|
170
|
+
office_hash[:type] = 'district'
|
171
|
+
end
|
171
172
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
173
|
+
office_hash[:line_1] = office['line1']
|
174
|
+
office_hash[:line_2] = office['line_2']
|
175
|
+
office_hash[:line_3] = "#{office['city'].capitalize}, #{office['state']} #{office['zip']}"
|
176
|
+
offices << office_hash
|
177
|
+
end
|
176
178
|
end
|
177
179
|
|
178
180
|
offices
|