google_places 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/Gemfile.lock +1 -1
- data/README.rdoc +28 -2
- data/google_places.gemspec +1 -1
- data/lib/google_places.rb +1 -1
- data/lib/google_places/client.rb +33 -25
- data/lib/google_places/error.rb +0 -1
- data/lib/google_places/photo.rb +1 -7
- data/lib/google_places/prediction.rb +71 -0
- data/lib/google_places/request.rb +24 -24
- data/lib/google_places/spot.rb +20 -43
- data/spec/google_places/client_spec.rb +10 -5
- data/spec/google_places/location_spec.rb +0 -2
- data/spec/google_places/photo_spec.rb +4 -3
- data/spec/google_places/prediction_spec.rb +58 -0
- data/spec/google_places/request_spec.rb +0 -19
- data/spec/google_places/spot_spec.rb +14 -15
- data/spec/vcr_cassettes/list_predictions.yml +845 -0
- data/spec/vcr_cassettes/list_spots.yml +3364 -44
- data/spec/vcr_cassettes/list_spots_by_radar.yml +1070 -14
- data/spec/vcr_cassettes/list_spots_with_multiple_types.yml +1192 -10
- data/spec/vcr_cassettes/list_spots_with_name.yml +6 -6
- data/spec/vcr_cassettes/list_spots_with_name_and_types.yml +156 -6
- data/spec/vcr_cassettes/list_spots_with_single_type.yml +640 -6
- data/spec/vcr_cassettes/list_spots_with_types_and_exclusion.yml +1194 -10
- data/spec/vcr_cassettes/multiple_page_request.yml +4194 -8
- data/spec/vcr_cassettes/photo.yml +84 -2
- data/spec/vcr_cassettes/premium_list_spots_with_data.yml +3 -3
- data/spec/vcr_cassettes/single_spot.yml +1386 -16
- metadata +7 -2
data/lib/google_places/spot.rb
CHANGED
@@ -10,9 +10,6 @@ module GooglePlaces
|
|
10
10
|
# @param [String,Integer] lat the latitude for the search
|
11
11
|
# @param [String,Integer] lng the longitude for the search
|
12
12
|
# @param [String] api_key the provided api key
|
13
|
-
# @param [Boolean] sensor
|
14
|
-
# Indicates whether or not the Place request came from a device using a location sensor (e.g. a GPS) to determine the location sent in this request.
|
15
|
-
# <b>Note that this is a mandatory parameter</b>
|
16
13
|
# @param [Hash] options
|
17
14
|
# @option options [Integer] :radius (1000)
|
18
15
|
# Defines the distance (in meters) within which to return Place results.
|
@@ -50,7 +47,7 @@ module GooglePlaces
|
|
50
47
|
#
|
51
48
|
# @see http://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1 List of supported languages
|
52
49
|
# @see https://developers.google.com/maps/documentation/places/supported_types List of supported types
|
53
|
-
def self.list(lat, lng, api_key,
|
50
|
+
def self.list(lat, lng, api_key, options = {})
|
54
51
|
location = Location.new(lat, lng)
|
55
52
|
multipage_request = !!options.delete(:multipage)
|
56
53
|
rankby = options.delete(:rankby)
|
@@ -67,7 +64,6 @@ module GooglePlaces
|
|
67
64
|
options = {
|
68
65
|
:location => location.format,
|
69
66
|
:radius => radius,
|
70
|
-
:sensor => sensor,
|
71
67
|
:rankby => rankby,
|
72
68
|
:key => api_key,
|
73
69
|
:name => name,
|
@@ -93,9 +89,6 @@ module GooglePlaces
|
|
93
89
|
# @param [String,Integer] lat the latitude for the search
|
94
90
|
# @param [String,Integer] lng the longitude for the search
|
95
91
|
# @param [String] api_key the provided api key
|
96
|
-
# @param [Boolean] sensor
|
97
|
-
# Indicates whether or not the Place request came from a device using a location sensor (e.g. a GPS) to determine the location sent in this request.
|
98
|
-
# <b>Note that this is a mandatory parameter</b>
|
99
92
|
# @param [Hash] options
|
100
93
|
# @option options [Integer] :radius (1000)
|
101
94
|
# Defines the distance (in meters) within which to return Place results.
|
@@ -115,12 +108,12 @@ module GooglePlaces
|
|
115
108
|
# @option options [Integer] :maxprice
|
116
109
|
# Restricts results to only those places within the specified price range. Valid values range between 0 (most affordable) to 4 (most expensive), inclusive.
|
117
110
|
# @option options [Boolean] :opennow
|
118
|
-
# Retricts results to those Places that are open for business at the time the query is sent.
|
119
|
-
# Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query.
|
111
|
+
# Retricts results to those Places that are open for business at the time the query is sent.
|
112
|
+
# Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query.
|
120
113
|
# Setting openNow to false has no effect.
|
121
114
|
# @option options [Boolean] :zagatselected
|
122
|
-
# Restrict your search to only those locations that are Zagat selected businesses.
|
123
|
-
# This parameter does not require a true or false value, simply including the parameter in the request is sufficient to restrict your search.
|
115
|
+
# Restrict your search to only those locations that are Zagat selected businesses.
|
116
|
+
# This parameter does not require a true or false value, simply including the parameter in the request is sufficient to restrict your search.
|
124
117
|
# The zagatselected parameter is experimental, and only available to Places API enterprise customers.
|
125
118
|
# @option options [Hash] :retry_options ({})
|
126
119
|
# A Hash containing parameters for search retries
|
@@ -130,10 +123,10 @@ module GooglePlaces
|
|
130
123
|
#
|
131
124
|
# @see https://developers.google.com/places/documentation/search#RadarSearchRequests Radar Search
|
132
125
|
# @see https://developers.google.com/maps/documentation/places/supported_types List of supported types
|
133
|
-
def self.list_by_radar(lat, lng, api_key,
|
126
|
+
def self.list_by_radar(lat, lng, api_key, options = {})
|
134
127
|
location = Location.new(lat, lng)
|
135
128
|
multipage_request = !!options.delete(:multipage)
|
136
|
-
radius = options.delete(:radius) || 1000
|
129
|
+
radius = options.delete(:radius) || 1000
|
137
130
|
types = options.delete(:types)
|
138
131
|
name = options.delete(:name)
|
139
132
|
keyword = options.delete(:keyword)
|
@@ -147,7 +140,6 @@ module GooglePlaces
|
|
147
140
|
options = {
|
148
141
|
:location => location.format,
|
149
142
|
:radius => radius,
|
150
|
-
:sensor => sensor,
|
151
143
|
:key => api_key,
|
152
144
|
:name => name,
|
153
145
|
:keyword => keyword,
|
@@ -175,10 +167,6 @@ module GooglePlaces
|
|
175
167
|
# @return [Spot]
|
176
168
|
# @param [String] place_id the place_id of the spot
|
177
169
|
# @param [String] api_key the provided api key
|
178
|
-
# @param [Boolean] sensor
|
179
|
-
# Indicates whether or not the Place request came from a device using a location sensor (e.g. a GPS)
|
180
|
-
# to determine the location sent in this request.
|
181
|
-
# <b>Note that this is a mandatory parameter</b>
|
182
170
|
# @param [Hash] options
|
183
171
|
# @option options [String] :language
|
184
172
|
# The language code, indicating in which language the results should be returned, if possible.
|
@@ -188,21 +176,20 @@ module GooglePlaces
|
|
188
176
|
# @option options [Object] :retry_options[:status] ([])
|
189
177
|
# @option options [Integer] :retry_options[:max] (0) the maximum retries
|
190
178
|
# @option options [Integer] :retry_options[:delay] (5) the delay between each retry in seconds
|
191
|
-
def self.find(place_id, api_key,
|
179
|
+
def self.find(place_id, api_key, options = {})
|
192
180
|
language = options.delete(:language)
|
193
181
|
retry_options = options.delete(:retry_options) || {}
|
194
182
|
extensions = options.delete(:review_summary) ? 'review_summary' : nil
|
195
183
|
|
196
184
|
response = Request.spot(
|
197
185
|
:placeid => place_id,
|
198
|
-
:sensor => sensor,
|
199
186
|
:key => api_key,
|
200
187
|
:language => language,
|
201
188
|
:extensions => extensions,
|
202
189
|
:retry_options => retry_options
|
203
190
|
)
|
204
191
|
|
205
|
-
self.new(response['result'], api_key
|
192
|
+
self.new(response['result'], api_key)
|
206
193
|
end
|
207
194
|
|
208
195
|
# Search for Spots with a pagetoken
|
@@ -210,15 +197,13 @@ module GooglePlaces
|
|
210
197
|
# @return [Array<Spot>]
|
211
198
|
# @param [String] pagetoken the token to find next results
|
212
199
|
# @param [String] api_key the provided api key
|
213
|
-
# @param [Boolean] sensor
|
214
200
|
# @param [Hash] options
|
215
|
-
def self.list_by_pagetoken(pagetoken, api_key,
|
201
|
+
def self.list_by_pagetoken(pagetoken, api_key, options = {})
|
216
202
|
exclude = options.delete(:exclude) || []
|
217
203
|
exclude = [exclude] unless exclude.is_a?(Array)
|
218
204
|
|
219
205
|
options = {
|
220
206
|
:pagetoken => pagetoken,
|
221
|
-
:sensor => sensor,
|
222
207
|
:key => api_key
|
223
208
|
}
|
224
209
|
|
@@ -230,10 +215,6 @@ module GooglePlaces
|
|
230
215
|
# @return [Array<Spot>]
|
231
216
|
# @param [String] query the query to search for
|
232
217
|
# @param [String] api_key the provided api key
|
233
|
-
# @param [Boolean] sensor
|
234
|
-
# Indicates whether or not the Place request came from a device using a location sensor (e.g. a GPS)
|
235
|
-
# to determine the location sent in this request.
|
236
|
-
# <b>Note that this is a mandatory parameter</b>
|
237
218
|
# @param [Hash] options
|
238
219
|
# @option options [String,Integer] :lat
|
239
220
|
# the latitude for the search
|
@@ -268,7 +249,7 @@ module GooglePlaces
|
|
268
249
|
#
|
269
250
|
# @see http://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1 List of supported languages
|
270
251
|
# @see https://developers.google.com/maps/documentation/places/supported_types List of supported types
|
271
|
-
def self.list_by_query(query, api_key,
|
252
|
+
def self.list_by_query(query, api_key, options = {})
|
272
253
|
if options.has_key?(:lat) && options.has_key?(:lng)
|
273
254
|
with_location = true
|
274
255
|
else
|
@@ -282,7 +263,6 @@ module GooglePlaces
|
|
282
263
|
end
|
283
264
|
|
284
265
|
query = query
|
285
|
-
sensor = sensor
|
286
266
|
multipage_request = !!options.delete(:multipage)
|
287
267
|
location = Location.new(options.delete(:lat), options.delete(:lng)) if with_location
|
288
268
|
radius = options.delete(:radius) if with_radius
|
@@ -296,7 +276,6 @@ module GooglePlaces
|
|
296
276
|
|
297
277
|
options = {
|
298
278
|
:query => query,
|
299
|
-
:sensor => sensor,
|
300
279
|
:key => api_key,
|
301
280
|
:rankby => rankby,
|
302
281
|
:language => language,
|
@@ -322,7 +301,7 @@ module GooglePlaces
|
|
322
301
|
# Some places returned by Google do not have a 'types' property. If the user specified 'types', then
|
323
302
|
# this is a non-issue because those places will not be returned. However, if the user did not specify
|
324
303
|
# 'types', then we do not want to filter out places with a missing 'types' property from the results set.
|
325
|
-
results << self.new(result, options[:key]
|
304
|
+
results << self.new(result, options[:key]) if result['types'].nil? || (result['types'] & exclude) == []
|
326
305
|
end
|
327
306
|
|
328
307
|
results
|
@@ -344,8 +323,7 @@ module GooglePlaces
|
|
344
323
|
if multipage_request && !response["next_page_token"].nil?
|
345
324
|
options = {
|
346
325
|
:pagetoken => response["next_page_token"],
|
347
|
-
:key => options[:key]
|
348
|
-
:sensor => options[:sensor]
|
326
|
+
:key => options[:key]
|
349
327
|
}
|
350
328
|
|
351
329
|
# There is a short delay between when a next_page_token is issued, and when it will become valid.
|
@@ -361,7 +339,7 @@ module GooglePlaces
|
|
361
339
|
|
362
340
|
# @param [JSON] json_result_object a JSON object to create a Spot from
|
363
341
|
# @return [Spot] a newly created spot
|
364
|
-
def initialize(json_result_object, api_key
|
342
|
+
def initialize(json_result_object, api_key)
|
365
343
|
@reference = json_result_object['reference']
|
366
344
|
@place_id = json_result_object['place_id']
|
367
345
|
@vicinity = json_result_object['vicinity']
|
@@ -392,7 +370,7 @@ module GooglePlaces
|
|
392
370
|
@zagat_selected = json_result_object['zagat_selected']
|
393
371
|
@aspects = aspects_component(json_result_object['aspects'])
|
394
372
|
@review_summary = json_result_object['review_summary']
|
395
|
-
@photos = photos_component(json_result_object['photos'], api_key
|
373
|
+
@photos = photos_component(json_result_object['photos'], api_key)
|
396
374
|
@reviews = reviews_component(json_result_object['reviews'])
|
397
375
|
@nextpagetoken = json_result_object['nextpagetoken']
|
398
376
|
@events = events_component(json_result_object['events'])
|
@@ -433,16 +411,15 @@ module GooglePlaces
|
|
433
411
|
json_aspects.to_a.map{ |r| { :type => r['type'], :rating => r['rating'] } }
|
434
412
|
end
|
435
413
|
|
436
|
-
def photos_component(json_photos, api_key
|
414
|
+
def photos_component(json_photos, api_key)
|
437
415
|
if json_photos
|
438
|
-
json_photos.map{ |p|
|
416
|
+
json_photos.map{ |p|
|
439
417
|
Photo.new(
|
440
|
-
p['width'],
|
418
|
+
p['width'],
|
441
419
|
p['height'],
|
442
420
|
p['photo_reference'],
|
443
|
-
p['html_attributions'],
|
444
|
-
api_key
|
445
|
-
sensor
|
421
|
+
p['html_attributions'],
|
422
|
+
api_key
|
446
423
|
)
|
447
424
|
}
|
448
425
|
else []
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GooglePlaces::Client do
|
4
|
-
|
5
4
|
it 'should initialize with an api_key' do
|
6
5
|
@client = GooglePlaces::Client.new(api_key)
|
7
6
|
expect(@client.api_key).to eq(api_key)
|
@@ -10,7 +9,7 @@ describe GooglePlaces::Client do
|
|
10
9
|
it 'should request spots' do
|
11
10
|
lat, lng = '-33.8670522', '151.1957362'
|
12
11
|
@client = GooglePlaces::Client.new(api_key)
|
13
|
-
expect(GooglePlaces::Spot).to receive(:list).with(lat, lng, api_key,
|
12
|
+
expect(GooglePlaces::Spot).to receive(:list).with(lat, lng, api_key, {})
|
14
13
|
|
15
14
|
@client.spots(lat, lng)
|
16
15
|
end
|
@@ -18,7 +17,7 @@ describe GooglePlaces::Client do
|
|
18
17
|
it 'should request a single spot by place_id' do
|
19
18
|
place_id = 'ChIJu46S-ZZhLxMROG5lkwZ3D7k'
|
20
19
|
@client = GooglePlaces::Client.new(api_key)
|
21
|
-
expect(GooglePlaces::Spot).to receive(:find).with(place_id, api_key,
|
20
|
+
expect(GooglePlaces::Spot).to receive(:find).with(place_id, api_key, {})
|
22
21
|
|
23
22
|
@client.spot(place_id)
|
24
23
|
end
|
@@ -26,7 +25,7 @@ describe GooglePlaces::Client do
|
|
26
25
|
it 'should request spots by query' do
|
27
26
|
query = 'Statue of liberty, New York'
|
28
27
|
@client = GooglePlaces::Client.new(api_key)
|
29
|
-
expect(GooglePlaces::Spot).to receive(:list_by_query).with(query, api_key,
|
28
|
+
expect(GooglePlaces::Spot).to receive(:list_by_query).with(query, api_key, {})
|
30
29
|
|
31
30
|
@client.spots_by_query(query)
|
32
31
|
end
|
@@ -36,10 +35,16 @@ describe GooglePlaces::Client do
|
|
36
35
|
lat, lng = '51.511627', '-0.183778'
|
37
36
|
radius = 5000
|
38
37
|
@client = GooglePlaces::Client.new(api_key)
|
39
|
-
expect(GooglePlaces::Spot).to receive(:list_by_radar).with(lat, lng, api_key,
|
38
|
+
expect(GooglePlaces::Spot).to receive(:list_by_radar).with(lat, lng, api_key, {:radius=> radius, :keyword => keywords})
|
40
39
|
|
41
40
|
@client.spots_by_radar(lat, lng, :radius => radius, :keyword => keywords)
|
42
41
|
end
|
43
42
|
|
43
|
+
it 'should request predictions by input' do
|
44
|
+
input = 'Atlanta'
|
45
|
+
@client = GooglePlaces::Client.new(api_key)
|
46
|
+
expect(GooglePlaces::Prediction).to receive(:list_by_input).with(input, api_key, {})
|
44
47
|
|
48
|
+
@client.predictions_by_input(input)
|
49
|
+
end
|
45
50
|
end
|
@@ -1,25 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GooglePlaces::Photo do
|
4
|
-
|
5
4
|
before :each do
|
6
5
|
@max_width = 400
|
7
|
-
@sensor = false
|
8
6
|
@photo_reference = "CnRtAAAACQQXR83Jc3Pffxt1Zx7QbCe6AfY2negSNzkk2IeSf0q5nxHgartLzkr1fltSlkEDSS-EZqswWAW2eQDbiOl12J-V4Rmn_JNko9e9gSnMwxHBdmScu_84NMSe-0RwB9BM6AEqE8sENXQ8cpWaiEsC_RIQLzIJxpRdoqSPrPtrjTrOhxoUWb8uwObkV4duXfKIiNB20gfnu88"
|
9
7
|
end
|
10
8
|
|
11
9
|
context 'Photo', vcr: { cassette_name: 'photo'} do
|
12
10
|
before :each do
|
13
|
-
@photo = GooglePlaces::Photo.new(400, 400, @photo_reference, [], api_key
|
11
|
+
@photo = GooglePlaces::Photo.new(400, 400, @photo_reference, [], api_key)
|
14
12
|
end
|
13
|
+
|
15
14
|
it 'should be a Photo' do
|
16
15
|
expect(@photo.class).to eq(GooglePlaces::Photo)
|
17
16
|
end
|
17
|
+
|
18
18
|
%w(width height photo_reference html_attributions).each do |attribute|
|
19
19
|
it "should have the attribute: #{attribute}" do
|
20
20
|
expect(@photo.respond_to?(attribute)).to eq(true)
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
23
24
|
it 'should return a url when fetched' do
|
24
25
|
url = @photo.fetch_url(@max_width)
|
25
26
|
expect(url).to_not be_empty
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GooglePlaces::Prediction, vcr: { cassette_name: 'list_predictions'} do
|
4
|
+
it "should be a collection of Prediction" do
|
5
|
+
collection = GooglePlaces::Prediction.list_by_input('query', api_key)
|
6
|
+
|
7
|
+
expect(collection.map(&:class).uniq).to eq [GooglePlaces::Prediction]
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'requests' do
|
11
|
+
before(:each) do
|
12
|
+
allow(GooglePlaces::Request).to receive(:predictions_by_input).and_return('predictions' => [])
|
13
|
+
end
|
14
|
+
|
15
|
+
it "initiates a request with `radius`" do
|
16
|
+
options = request_params(radius: 20, location: "1.00000000,2.00000000")
|
17
|
+
expect(GooglePlaces::Request).to receive(:predictions_by_input).with(options)
|
18
|
+
|
19
|
+
GooglePlaces::Prediction.list_by_input('query', api_key, lat: 1, lng: 2, radius: 20)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "initiates a request with `types`" do
|
23
|
+
options = request_params(types: '(cities)')
|
24
|
+
expect(GooglePlaces::Request).to receive(:predictions_by_input).with(options)
|
25
|
+
|
26
|
+
GooglePlaces::Prediction.list_by_input('query', api_key, types: '(cities)')
|
27
|
+
end
|
28
|
+
|
29
|
+
it "initiates a request with `language`" do
|
30
|
+
options = request_params(language: 'es')
|
31
|
+
expect(GooglePlaces::Request).to receive(:predictions_by_input).with(options)
|
32
|
+
|
33
|
+
GooglePlaces::Prediction.list_by_input('query', api_key, language: 'es')
|
34
|
+
end
|
35
|
+
|
36
|
+
it "initiates a request with `types` joind by |" do
|
37
|
+
options = request_params(types: 'establishment|geocode')
|
38
|
+
expect(GooglePlaces::Request).to receive(:predictions_by_input).with(options)
|
39
|
+
|
40
|
+
GooglePlaces::Prediction.list_by_input('query', api_key, types: ['establishment', 'geocode'])
|
41
|
+
end
|
42
|
+
|
43
|
+
it "initiates a request with `retry_options`" do
|
44
|
+
options = request_params(retry_options: { max: 10, delay: 15 })
|
45
|
+
expect(GooglePlaces::Request).to receive(:predictions_by_input).with(options)
|
46
|
+
|
47
|
+
GooglePlaces::Prediction.list_by_input('query', api_key, retry_options: { max: 10, delay: 15 })
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def request_params(options = {})
|
52
|
+
{
|
53
|
+
input: "query",
|
54
|
+
key: api_key,
|
55
|
+
retry_options: {}
|
56
|
+
}.merge(options)
|
57
|
+
end
|
58
|
+
end
|
@@ -6,7 +6,6 @@ describe GooglePlaces::Request do
|
|
6
6
|
@location = GooglePlaces::Location.new('-33.8670522', '151.1957362').format
|
7
7
|
@query = 'Statue of liberty, New York'
|
8
8
|
@radius = 200
|
9
|
-
@sensor = false
|
10
9
|
@reference = 'CnRsAAAASc4grenwL0h3X5VPNp5fkDNfqbjt3iQtWIPlKS-3ms9GbnCxR_FLHO0B0ZKCgJSg19qymkeHagjQFB4aUL87yhp4mhFTc17DopK1oiYDaeGthztSjERic8TmFNe-6zOpKSdiZWKE6xlQvcbSiWIJchIQOEYZqunSSZqNDoBSs77bWRoUJcMMVANtSlhy0llKI0MI6VcC7DU'
|
11
10
|
@reference_not_found = 'CnRpAAAAlO2WvF_4eOqp02TAWKsXpPSCFz8KxBjraWhB4MSvdUPqXN0yCpxQgblam1LeRENcWZF-9-2CEfUwlHUli61PaYe0e7dUPAU302tk6KkalnKqx7nv07iFA1Ca_Y1WoCLH9adEWwkxKMITlbGhUUz9-hIQPxQ4Bp_dz5nHloUFkj3rkBoUDSPqy2smqMnPEo4ayfbDupeKEZY'
|
12
11
|
@keyword = 'attractions'
|
@@ -18,7 +17,6 @@ describe GooglePlaces::Request do
|
|
18
17
|
response = GooglePlaces::Request.spots(
|
19
18
|
:location => @location,
|
20
19
|
:radius => @radius,
|
21
|
-
:sensor => @sensor,
|
22
20
|
:key => api_key
|
23
21
|
)
|
24
22
|
expect(response['results']).to_not be_empty
|
@@ -30,7 +28,6 @@ describe GooglePlaces::Request do
|
|
30
28
|
expect(lambda {
|
31
29
|
GooglePlaces::Request.spots(
|
32
30
|
:radius => @radius,
|
33
|
-
:sensor => @sensor,
|
34
31
|
:key => api_key
|
35
32
|
)
|
36
33
|
}).to raise_error GooglePlaces::InvalidRequestError
|
@@ -42,7 +39,6 @@ describe GooglePlaces::Request do
|
|
42
39
|
expect(lambda {
|
43
40
|
GooglePlaces::Request.spots(
|
44
41
|
:radius => @radius,
|
45
|
-
:sensor => @sensor,
|
46
42
|
:key => api_key,
|
47
43
|
:retry_options => {
|
48
44
|
:max => 3,
|
@@ -58,7 +54,6 @@ describe GooglePlaces::Request do
|
|
58
54
|
expect(lambda {
|
59
55
|
GooglePlaces::Request.spots(
|
60
56
|
:radius => @radius,
|
61
|
-
:sensor => @sensor,
|
62
57
|
:key => api_key,
|
63
58
|
:retry_options => {
|
64
59
|
:max => 3,
|
@@ -81,7 +76,6 @@ describe GooglePlaces::Request do
|
|
81
76
|
it 'should retrieve a list of spots' do
|
82
77
|
response = GooglePlaces::Request.spots_by_query(
|
83
78
|
:query => @query,
|
84
|
-
:sensor => @sensor,
|
85
79
|
:key => api_key
|
86
80
|
)
|
87
81
|
|
@@ -94,7 +88,6 @@ describe GooglePlaces::Request do
|
|
94
88
|
it do
|
95
89
|
expect(lambda {
|
96
90
|
GooglePlaces::Request.spots_by_query(
|
97
|
-
:sensor => @sensor,
|
98
91
|
:key => api_key
|
99
92
|
)
|
100
93
|
}).to raise_error GooglePlaces::InvalidRequestError
|
@@ -106,7 +99,6 @@ describe GooglePlaces::Request do
|
|
106
99
|
it do
|
107
100
|
expect(lambda {
|
108
101
|
GooglePlaces::Request.spots_by_query(
|
109
|
-
:sensor => @sensor,
|
110
102
|
:key => api_key,
|
111
103
|
:retry_options => {
|
112
104
|
:max => 3,
|
@@ -122,7 +114,6 @@ describe GooglePlaces::Request do
|
|
122
114
|
it do
|
123
115
|
expect(lambda {
|
124
116
|
GooglePlaces::Request.spots_by_query(
|
125
|
-
:sensor => @sensor,
|
126
117
|
:key => api_key,
|
127
118
|
:retry_options => {
|
128
119
|
:max => 3,
|
@@ -143,7 +134,6 @@ describe GooglePlaces::Request do
|
|
143
134
|
it 'should retrieve a single spot' do
|
144
135
|
response = GooglePlaces::Request.spot(
|
145
136
|
:reference => @reference,
|
146
|
-
:sensor => @sensor,
|
147
137
|
:key => api_key
|
148
138
|
)
|
149
139
|
expect(response['result']).to_not be_empty
|
@@ -153,7 +143,6 @@ describe GooglePlaces::Request do
|
|
153
143
|
expect(lambda {
|
154
144
|
GooglePlaces::Request.spot(
|
155
145
|
:reference => @reference_not_found,
|
156
|
-
:sensor => @sensor,
|
157
146
|
:key => api_key
|
158
147
|
)
|
159
148
|
}).to raise_error GooglePlaces::NotFoundError
|
@@ -165,7 +154,6 @@ describe GooglePlaces::Request do
|
|
165
154
|
it do
|
166
155
|
expect(lambda {
|
167
156
|
GooglePlaces::Request.spot(
|
168
|
-
:sensor => @sensor,
|
169
157
|
:key => api_key
|
170
158
|
)
|
171
159
|
}).to raise_error GooglePlaces::InvalidRequestError
|
@@ -176,7 +164,6 @@ describe GooglePlaces::Request do
|
|
176
164
|
it do
|
177
165
|
expect(lambda {
|
178
166
|
GooglePlaces::Request.spot(
|
179
|
-
:sensor => @sensor,
|
180
167
|
:key => api_key,
|
181
168
|
:retry_options => {
|
182
169
|
:max => 3,
|
@@ -191,7 +178,6 @@ describe GooglePlaces::Request do
|
|
191
178
|
it do
|
192
179
|
expect(lambda {
|
193
180
|
GooglePlaces::Request.spot(
|
194
|
-
:sensor => @sensor,
|
195
181
|
:key => api_key,
|
196
182
|
:retry_options => {
|
197
183
|
:max => 3,
|
@@ -218,7 +204,6 @@ describe GooglePlaces::Request do
|
|
218
204
|
:location => @location,
|
219
205
|
:keyword => @keyword,
|
220
206
|
:radius => @radius,
|
221
|
-
:sensor => @sensor,
|
222
207
|
:key => api_key
|
223
208
|
)
|
224
209
|
expect(response['results']).to_not be_empty
|
@@ -231,7 +216,6 @@ describe GooglePlaces::Request do
|
|
231
216
|
:location => @location,
|
232
217
|
:name => 'park',
|
233
218
|
:radius => @radius,
|
234
|
-
:sensor => @sensor,
|
235
219
|
:key => api_key
|
236
220
|
)
|
237
221
|
expect(response['results']).to_not be_empty
|
@@ -246,7 +230,6 @@ describe GooglePlaces::Request do
|
|
246
230
|
GooglePlaces::Request.spots_by_radar(
|
247
231
|
:location => @location,
|
248
232
|
:radius => @radius,
|
249
|
-
:sensor => @sensor,
|
250
233
|
:key => api_key
|
251
234
|
)
|
252
235
|
}).to raise_error GooglePlaces::InvalidRequestError
|
@@ -260,7 +243,6 @@ describe GooglePlaces::Request do
|
|
260
243
|
GooglePlaces::Request.spots_by_radar(
|
261
244
|
:location => @location,
|
262
245
|
:radius => @radius,
|
263
|
-
:sensor => @sensor,
|
264
246
|
:key => api_key,
|
265
247
|
:retry_options => {
|
266
248
|
:max => 3,
|
@@ -278,7 +260,6 @@ describe GooglePlaces::Request do
|
|
278
260
|
GooglePlaces::Request.spots_by_radar(
|
279
261
|
:location => @location,
|
280
262
|
:radius => @radius,
|
281
|
-
:sensor => @sensor,
|
282
263
|
:key => api_key,
|
283
264
|
:retry_options => {
|
284
265
|
:max => 3,
|