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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/get_your_rep/google.rb +14 -12
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3376c10366f2d6101ef78c52b53cdf89d93f7509
4
- data.tar.gz: 9a5841be0ff94e94d45a1f677f192fa59a2e71b0
3
+ metadata.gz: 6f38b5373ce38e6de289e60a8548ee29d75c5a25
4
+ data.tar.gz: 3e00ec4aae39f8731e6a798eae047cb4b9ce0d3e
5
5
  SHA512:
6
- metadata.gz: c423e28ca028809f7e7e829467af1061589c9e61f3e000c8837207d906d38afffc8778e94bf2376ac3fce3c86ae54482cff6b7d427f558607723543bff44218d
7
- data.tar.gz: e693464d40fbeb0710fa8ca7d9c0e98afecf623a1082356388ebc81266cae1a4f6f89b9cda9a142ee66a4bd2631ee2caa65e641427928913e98dd1d3e4eb9a54
6
+ metadata.gz: 3301d1ea4add95e1d7d2647d93663ae8cd07347768b8a8c3b04d2cb1699575de252845b740ec72b3931c1254eb7e69f19ef4a6cc9e2794ea389e68ef8411137c
7
+ data.tar.gz: 3b964af288d448ac939bc86437104cd9abaaa967cefae3c17a9688c88f648f6d017dff312fe67c4d434d146b6d3618efd7498579e9d0ff57cc4bce50d3456936
@@ -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'].each do |office|
164
- office_hash = {}
163
+ if official['address']
164
+ official['address'].each do |office|
165
+ office_hash = {}
165
166
 
166
- if office['line1'].downcase.match(/(state|house|senate|assembly|capitol|dirksen|reyburn|rayburn|legislative|legislature|government)+/)
167
- office_hash[:type] = 'capitol'
168
- else
169
- office_hash[:type] = 'district'
170
- end
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
- office_hash[:line_1] = office['line1']
173
- office_hash[:line_2] = office['line_2']
174
- office_hash[:line_3] = "#{office['city'].capitalize}, #{office['state']} #{office['zip']}"
175
- offices << office_hash
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_your_rep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - msimonborg