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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 387de44f079fb798d7e8deaa8bc46a42d763ec0a
4
- data.tar.gz: 9bbb44f6b5574112cfedaa607e56a5e3c60bc20a
3
+ metadata.gz: 889a30b980d14ee5ee37b68dcc30c0039e6fb4ba
4
+ data.tar.gz: 3d45cca721b971574e5e325e1e4545b8eb033e97
5
5
  SHA512:
6
- metadata.gz: 389d7e6dae6fc9319a0f12dfc8f4ec6815fb82196518223da303c46934ac47bc28782ba499e7b029f67078c01a4d96d4466267f607114bba5503a5d688a66a0f
7
- data.tar.gz: 43b8852b9f38cba0f0e786d1d02f34cf5a4e3498dfea7efa33ef43da2ac9efebf21d310ca2a6b9fd7e657c9323a4bfa71a5439c4fed387e65b5aa910f746cc71
6
+ metadata.gz: 7d271beb633273d4c7846d3b65ba5440536804bd45b4f4e586d8dafe7a5822494c496d916528b703fd9bb7f9f39f173972203e78f6374594596c9b58f750e4f1
7
+ data.tar.gz: 6593dd4a627405d28825f2f75729225a56b7774003bc2aa7fc3d07543eb27cd22cd175ed11e628bc0d81726025ee8c913745cf9d36eec93c69583d55d9dd6999
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- google_places (0.26.0)
4
+ google_places (0.27.0)
5
5
  httparty (~> 0.13.1)
6
6
 
7
7
  GEM
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'google_places'
6
- s.version = '0.27.0'
6
+ s.version = '0.28.0'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Marcel de Graaf']
9
9
  s.email = ['mail@marceldegraaf.net']
@@ -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.27.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: 2014-11-02 00:00:00.000000000 Z
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: