google-maps 3.0.6 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63fbd8b11238001389fff8a0e84bb1fa0c9fea0f674792ca4fd5a6d7fcb1b8a5
4
- data.tar.gz: 2dd65ff3cccabe859ac5cd12689ff2e0c039020e3ee631539e46ba22163e4124
3
+ metadata.gz: 413ed7b9a370d5b4ccf30a72d670406c8c286825e65d3e537856f5efe6f5e8d0
4
+ data.tar.gz: 2d6ae4b61bd9d65c6e8a785f2fb7c0a3d410f997d819a74dfeb31067f04606c9
5
5
  SHA512:
6
- metadata.gz: e58d772e216fb6a200a74e10391550e14f57d81e8854b5e3e97ac409c0d4d057428656413e49718381077ca9589b640a6f7728a5f2ec7abb5263243c3712cb00
7
- data.tar.gz: 3993629575a01844bfc9164bffa6015577a029549da06f7bb256ed84ec429fa718615ba78743c4c31ab0f149aa3af3fd19fbf17f7d00ecac8783ff24062ab3f9
6
+ metadata.gz: 79e462c797191eb7c8824573acb26cb19f106cc15880f1ae0585526f0ef99bb7a0901c42f0e5ee6b2f71ee9eade1eaa20fdf95808f6e9e02930b181475629cf9
7
+ data.tar.gz: bd1c83ee4c7dc6ad2d73fd22871151fe473743744c60ca6883290d661edf8f3071c4835d1e3e53f9acd4d55560622f35dd16b490c323e45e31fefd79dc1b9d20
data/google-maps.gemspec CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency('rubocop', '~> 0.79.0')
29
29
  s.add_development_dependency('simplecov', '~> 0.5')
30
30
  s.add_development_dependency('yard', '~> 0.9', '>= 0.9.11')
31
- s.add_dependency('hashie', '~> 3.6', '>= 3.6.0')
31
+ s.add_dependency('hashie', '~> 4.1', '>= 4.1.0')
32
32
  s.add_dependency('httpclient', '~> 2.7', '>= 2.7.1')
33
- s.add_dependency('json', '>= 1.7.5')
33
+ s.add_dependency('multi_json', '>= 1.15')
34
34
  s.add_dependency('ruby-hmac', '~> 0.4.0')
35
35
  end
@@ -63,13 +63,13 @@ module Google
63
63
  Google::Maps.logger.error e.message.to_s
64
64
  raise InvalidResponseException, "unknown error: #{e.message}"
65
65
  end
66
- handle_result_status(result.status)
66
+ handle_result_status(result.status, result.error_message)
67
67
  result
68
68
  end
69
69
 
70
- def handle_result_status(status)
71
- raise ZeroResultsException, "Google did not return any results: #{status}" if status == STATUS_ZERO_RESULTS
72
- raise InvalidResponseException, "Google returned an error status: #{status}" if status != STATUS_OK
70
+ def handle_result_status(status, error_message)
71
+ raise ZeroResultsException, "#{status}: #{error_message}" if status == STATUS_ZERO_RESULTS
72
+ raise InvalidResponseException, "#{status}: #{error_message}" if status != STATUS_OK
73
73
  end
74
74
 
75
75
  def url_with_api_key(service, args = {})
@@ -27,7 +27,7 @@ module Google
27
27
  def element
28
28
  element = distance_matrix.rows.first.elements.first
29
29
 
30
- raise Google::Maps::ZeroResultsException if element.status == 'NOT_FOUND'
30
+ raise Google::Maps::ZeroResultsException if (element.status == 'NOT_FOUND' || element.status == 'ZERO_RESULTS')
31
31
 
32
32
  element
33
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Google
4
4
  module Maps
5
- VERSION = '3.0.6'
5
+ VERSION = '3.0.7'
6
6
  end
7
7
  end
@@ -0,0 +1,14 @@
1
+ {
2
+ "destination_addresses" : [ "Amsterdam" ],
3
+ "origin_addresses" : [ "Utrecht" ],
4
+ "rows" : [
5
+ {
6
+ "elements" : [
7
+ {
8
+ "status" : "ZERO_RESULTS"
9
+ }
10
+ ]
11
+ }
12
+ ],
13
+ "status" : "OK"
14
+ }
@@ -12,5 +12,16 @@ describe Google::Maps::DistanceMatrix do
12
12
  its(:distance) { should eq 53_744 }
13
13
  its(:duration) { should eq 3237 }
14
14
  end
15
+
16
+ context ':nl and zero results' do
17
+ before { stub_response('distance-matrix-zero-results.json') }
18
+
19
+ it 'raises Google::Maps::ZeroResultsException' do
20
+
21
+ expect { subject.distance }.to raise_error(Google::Maps::ZeroResultsException)
22
+ expect { subject.duration }.to raise_error(Google::Maps::ZeroResultsException)
23
+
24
+ end
25
+ end
15
26
  end
16
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-maps
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel van Hoesel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-12 00:00:00.000000000 Z
11
+ date: 2022-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -162,20 +162,20 @@ dependencies:
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '3.6'
165
+ version: '4.1'
166
166
  - - ">="
167
167
  - !ruby/object:Gem::Version
168
- version: 3.6.0
168
+ version: 4.1.0
169
169
  type: :runtime
170
170
  prerelease: false
171
171
  version_requirements: !ruby/object:Gem::Requirement
172
172
  requirements:
173
173
  - - "~>"
174
174
  - !ruby/object:Gem::Version
175
- version: '3.6'
175
+ version: '4.1'
176
176
  - - ">="
177
177
  - !ruby/object:Gem::Version
178
- version: 3.6.0
178
+ version: 4.1.0
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: httpclient
181
181
  requirement: !ruby/object:Gem::Requirement
@@ -197,19 +197,19 @@ dependencies:
197
197
  - !ruby/object:Gem::Version
198
198
  version: 2.7.1
199
199
  - !ruby/object:Gem::Dependency
200
- name: json
200
+ name: multi_json
201
201
  requirement: !ruby/object:Gem::Requirement
202
202
  requirements:
203
203
  - - ">="
204
204
  - !ruby/object:Gem::Version
205
- version: 1.7.5
205
+ version: '1.15'
206
206
  type: :runtime
207
207
  prerelease: false
208
208
  version_requirements: !ruby/object:Gem::Requirement
209
209
  requirements:
210
210
  - - ">="
211
211
  - !ruby/object:Gem::Version
212
- version: 1.7.5
212
+ version: '1.15'
213
213
  - !ruby/object:Gem::Dependency
214
214
  name: ruby-hmac
215
215
  requirement: !ruby/object:Gem::Requirement
@@ -254,6 +254,7 @@ files:
254
254
  - spec/fixtures/den-haag-nl.json
255
255
  - spec/fixtures/deventer-en.json
256
256
  - spec/fixtures/deventer-nl.json
257
+ - spec/fixtures/distance-matrix-zero-results.json
257
258
  - spec/fixtures/distance-matrix.json
258
259
  - spec/fixtures/geocoder/amsterdam-en.json
259
260
  - spec/fixtures/geocoder/science-park-400-amsterdam-en.json
@@ -273,7 +274,7 @@ homepage: http://zilverline.com/
273
274
  licenses:
274
275
  - MIT
275
276
  metadata: {}
276
- post_install_message:
277
+ post_install_message:
277
278
  rdoc_options: []
278
279
  require_paths:
279
280
  - lib
@@ -288,8 +289,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
289
  - !ruby/object:Gem::Version
289
290
  version: '0'
290
291
  requirements: []
291
- rubygems_version: 3.1.2
292
- signing_key:
292
+ rubygems_version: 3.2.15
293
+ signing_key:
293
294
  specification_version: 4
294
295
  summary: Ruby wrapper for the Google Maps API
295
296
  test_files:
@@ -298,6 +299,7 @@ test_files:
298
299
  - spec/fixtures/den-haag-nl.json
299
300
  - spec/fixtures/deventer-en.json
300
301
  - spec/fixtures/deventer-nl.json
302
+ - spec/fixtures/distance-matrix-zero-results.json
301
303
  - spec/fixtures/distance-matrix.json
302
304
  - spec/fixtures/geocoder/amsterdam-en.json
303
305
  - spec/fixtures/geocoder/science-park-400-amsterdam-en.json