google_places 0.27.0 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/google_places.gemspec +1 -1
- data/lib/google_places/error.rb +4 -0
- data/spec/google_places/request_spec.rb +18 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 889a30b980d14ee5ee37b68dcc30c0039e6fb4ba
|
4
|
+
data.tar.gz: 3d45cca721b971574e5e325e1e4545b8eb033e97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d271beb633273d4c7846d3b65ba5440536804bd45b4f4e586d8dafe7a5822494c496d916528b703fd9bb7f9f39f173972203e78f6374594596c9b58f750e4f1
|
7
|
+
data.tar.gz: 6593dd4a627405d28825f2f75729225a56b7774003bc2aa7fc3d07543eb27cd22cd175ed11e628bc0d81726025ee8c913745cf9d36eec93c69583d55d9dd6999
|
data/Gemfile.lock
CHANGED
data/google_places.gemspec
CHANGED
data/lib/google_places/error.rb
CHANGED
@@ -5,9 +5,13 @@ module GooglePlaces
|
|
5
5
|
# Thrown when a request was denied by the server
|
6
6
|
#
|
7
7
|
# This can be the case when:
|
8
|
+
# - API key is not authorized for the Places API
|
8
9
|
# - querying the SPOT_LIST_URL <b>without</b> the following parameters:
|
9
10
|
# - - key
|
10
11
|
class RequestDeniedError < HTTParty::ResponseError
|
12
|
+
def to_s
|
13
|
+
response.parsed_response['error_message']
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
# Thrown when a request was rejected as invalid by the server
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'webmock/rspec'
|
2
3
|
|
3
4
|
describe GooglePlaces::Request do
|
4
5
|
|
@@ -205,11 +206,11 @@ describe GooglePlaces::Request do
|
|
205
206
|
:keyword => @keyword,
|
206
207
|
:radius => @radius,
|
207
208
|
:key => api_key
|
208
|
-
)
|
209
|
+
)
|
209
210
|
expect(response['results']).to_not be_empty
|
210
211
|
end
|
211
212
|
end
|
212
|
-
|
213
|
+
|
213
214
|
context 'with name' do
|
214
215
|
it do
|
215
216
|
response = GooglePlaces::Request.spots_by_radar(
|
@@ -275,4 +276,19 @@ describe GooglePlaces::Request do
|
|
275
276
|
end
|
276
277
|
end
|
277
278
|
|
279
|
+
context 'with an API key not authorized to use the Places API' do
|
280
|
+
it 'includes the error_message in the exception' do
|
281
|
+
stub_request(:get, "https://maps.googleapis.com/maps/api/place/details/json").
|
282
|
+
with(query: { reference: @reference, key: api_key }).
|
283
|
+
to_return(body: JSON.dump({ status: 'REQUEST_DENIED', error_message: 'This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console' }))
|
284
|
+
|
285
|
+
expect(lambda {
|
286
|
+
GooglePlaces::Request.spot(
|
287
|
+
:reference => @reference,
|
288
|
+
:key => api_key
|
289
|
+
)
|
290
|
+
}).to raise_error GooglePlaces::RequestDeniedError, 'This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console'
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
278
294
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_places
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcel de Graaf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -166,3 +166,4 @@ test_files:
|
|
166
166
|
- spec/vcr_cassettes/premium_list_spots_with_data.yml
|
167
167
|
- spec/vcr_cassettes/single_spot.yml
|
168
168
|
- spec/vcr_setup.rb
|
169
|
+
has_rdoc:
|