google_places 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +2 -2
- data/google_places.gemspec +1 -1
- data/lib/google_places/client.rb +15 -10
- data/lib/google_places/request.rb +12 -0
- data/lib/google_places/spot.rb +19 -2
- data/spec/google_places/client_spec.rb +95 -26
- data/spec/google_places/spot_spec.rb +26 -0
- data/spec/vcr_cassettes/list_spots.yml +180 -0
- data/spec/vcr_cassettes/single_spot.yml +726 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 749f35ddb5c9ce15000ca1d2b3aecb6154d2c227
|
4
|
+
data.tar.gz: dc73e83a3d8d21d9fa11e61c155e5aae827f80dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b3f62a1f9298f31581e3590f69593160cc5e4ef7841014f1b91ab2a5957e1a16b6451b900cc02cd7c573f09e8a8599e5625966e37db923c2fa8da6261496085
|
7
|
+
data.tar.gz: 1f701b72843382e71d22f39b1f32761232d0b6ed0b5541c01177b2a88f6ec827c1f19ed3addf78c94f0592afc498dadb87ce1f788b02675469db69a632d96f70
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
google_places (1.
|
4
|
+
google_places (1.2.0)
|
5
5
|
httparty (>= 0.13.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -12,7 +12,7 @@ GEM
|
|
12
12
|
safe_yaml (~> 1.0.0)
|
13
13
|
diff-lcs (1.3)
|
14
14
|
hashdiff (0.3.7)
|
15
|
-
httparty (0.
|
15
|
+
httparty (0.16.2)
|
16
16
|
multi_xml (>= 0.5.2)
|
17
17
|
multi_xml (0.6.0)
|
18
18
|
rspec (3.6.0)
|
data/google_places.gemspec
CHANGED
data/lib/google_places/client.rb
CHANGED
@@ -93,9 +93,10 @@ module GooglePlaces
|
|
93
93
|
# @see http://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1 List of supported languages
|
94
94
|
# @see https://developers.google.com/maps/documentation/places/supported_types List of supported types
|
95
95
|
def spots(lat, lng, options = {})
|
96
|
-
|
96
|
+
options = @options.merge(options)
|
97
|
+
detail = options.delete(:detail)
|
97
98
|
collection_detail_level(
|
98
|
-
Spot.list(lat, lng, @api_key,
|
99
|
+
Spot.list(lat, lng, @api_key, options),
|
99
100
|
detail
|
100
101
|
)
|
101
102
|
end
|
@@ -157,9 +158,10 @@ module GooglePlaces
|
|
157
158
|
# @see http://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1 List of supported languages
|
158
159
|
# @see https://developers.google.com/maps/documentation/places/supported_types List of supported types
|
159
160
|
def spots_by_query(query, options = {})
|
160
|
-
|
161
|
+
options = @options.merge(options)
|
162
|
+
detail = options.delete(:detail)
|
161
163
|
collection_detail_level(
|
162
|
-
Spot.list_by_query(query, @api_key,
|
164
|
+
Spot.list_by_query(query, @api_key, options),
|
163
165
|
detail
|
164
166
|
)
|
165
167
|
end
|
@@ -200,9 +202,10 @@ module GooglePlaces
|
|
200
202
|
#
|
201
203
|
# @see https://developers.google.com/maps/documentation/places/supported_types List of supported types
|
202
204
|
def spots_by_bounds(bounds, options = {})
|
203
|
-
|
205
|
+
options = @options.merge(options)
|
206
|
+
detail = options.delete(:detail)
|
204
207
|
collection_detail_level(
|
205
|
-
Spot.list_by_bounds(bounds, @api_key,
|
208
|
+
Spot.list_by_bounds(bounds, @api_key, options),
|
206
209
|
detail
|
207
210
|
)
|
208
211
|
end
|
@@ -224,9 +227,10 @@ module GooglePlaces
|
|
224
227
|
#
|
225
228
|
# @see https://developers.google.com/maps/documentation/places/supported_types List of supported types
|
226
229
|
def spots_by_pagetoken(pagetoken, options = {})
|
227
|
-
|
230
|
+
options = @options.merge(options)
|
231
|
+
detail = options.delete(:detail)
|
228
232
|
collection_detail_level(
|
229
|
-
Spot.list_by_pagetoken(pagetoken, @api_key,
|
233
|
+
Spot.list_by_pagetoken(pagetoken, @api_key, options),
|
230
234
|
detail
|
231
235
|
)
|
232
236
|
end
|
@@ -268,9 +272,10 @@ module GooglePlaces
|
|
268
272
|
#
|
269
273
|
# @see https://developers.google.com/places/documentation/search#RadarSearchRequests
|
270
274
|
def spots_by_radar(lat, lng, options = {})
|
271
|
-
|
275
|
+
options = @options.merge(options)
|
276
|
+
detail = options.delete(:detail)
|
272
277
|
collection_detail_level(
|
273
|
-
Spot.list_by_radar(lat, lng, @api_key,
|
278
|
+
Spot.list_by_radar(lat, lng, @api_key, options),
|
274
279
|
detail
|
275
280
|
)
|
276
281
|
end
|
@@ -72,6 +72,12 @@ module GooglePlaces
|
|
72
72
|
# <b>Note that this is a mandatory parameter</b>
|
73
73
|
# @option options [String] :language
|
74
74
|
# The language code, indicating in which language the results should be returned, if possible.
|
75
|
+
# @option options [String] :region
|
76
|
+
# The region code, specified as a ccTLD (country code top-level domain) two-character value. Most ccTLD
|
77
|
+
# codes are identical to ISO 3166-1 codes, with some exceptions. This parameter will only influence, not
|
78
|
+
# fully restrict, search results. If more relevant results exist outside of the specified region, they may
|
79
|
+
# be included. When this parameter is used, the country name is omitted from the resulting formatted_address
|
80
|
+
# for results in the specified region.
|
75
81
|
#
|
76
82
|
# @option options [Hash] :retry_options ({})
|
77
83
|
# A Hash containing parameters for search retries
|
@@ -181,6 +187,12 @@ module GooglePlaces
|
|
181
187
|
# Restricts the results to Spots matching at least one of the specified types
|
182
188
|
# @option options [String] :language
|
183
189
|
# The language code, indicating in which language the results should be returned, if possible.
|
190
|
+
# @option options [String] :region
|
191
|
+
# The region code, specified as a ccTLD (country code top-level domain) two-character value. Most ccTLD
|
192
|
+
# codes are identical to ISO 3166-1 codes, with some exceptions. This parameter will only influence, not
|
193
|
+
# fully restrict, search results. If more relevant results exist outside of the specified region, they may
|
194
|
+
# be included. When this parameter is used, the country name is omitted from the resulting formatted_address
|
195
|
+
# for results in the specified region.
|
184
196
|
# @option options [String,Array<String>] :exclude ([])
|
185
197
|
# A String or an Array of <b>types</b> to exclude from results
|
186
198
|
#
|
data/lib/google_places/spot.rb
CHANGED
@@ -236,6 +236,12 @@ module GooglePlaces
|
|
236
236
|
# @param [Hash] options
|
237
237
|
# @option options [String] :language
|
238
238
|
# The language code, indicating in which language the results should be returned, if possible.
|
239
|
+
# @option options [String] :region
|
240
|
+
# The region code, specified as a ccTLD (country code top-level domain) two-character value. Most ccTLD
|
241
|
+
# codes are identical to ISO 3166-1 codes, with some exceptions. This parameter will only influence, not
|
242
|
+
# fully restrict, search results. If more relevant results exist outside of the specified region, they may
|
243
|
+
# be included. When this parameter is used, the country name is omitted from the resulting formatted_address
|
244
|
+
# for results in the specified region.
|
239
245
|
#
|
240
246
|
# @option options [Hash] :retry_options ({})
|
241
247
|
# A Hash containing parameters for search retries
|
@@ -244,16 +250,19 @@ module GooglePlaces
|
|
244
250
|
# @option options [Integer] :retry_options[:delay] (5) the delay between each retry in seconds
|
245
251
|
def self.find(place_id, api_key, options = {})
|
246
252
|
language = options.delete(:language)
|
253
|
+
region = options.delete(:region)
|
247
254
|
retry_options = options.delete(:retry_options) || {}
|
248
255
|
extensions = options.delete(:review_summary) ? 'review_summary' : nil
|
249
256
|
|
250
|
-
|
257
|
+
request_options = {
|
251
258
|
:placeid => place_id,
|
252
259
|
:key => api_key,
|
253
260
|
:language => language,
|
254
261
|
:extensions => extensions,
|
255
262
|
:retry_options => retry_options
|
256
|
-
|
263
|
+
}
|
264
|
+
request_options[:region] = region unless region.nil?
|
265
|
+
response = Request.spot(request_options)
|
257
266
|
|
258
267
|
self.new(response['result'], api_key)
|
259
268
|
end
|
@@ -304,6 +313,12 @@ module GooglePlaces
|
|
304
313
|
# Restricts the results to Spots matching at least one of the specified types
|
305
314
|
# @option options [String] :language
|
306
315
|
# The language code, indicating in which language the results should be returned, if possible.
|
316
|
+
# @option options [String] :region
|
317
|
+
# The region code, specified as a ccTLD (country code top-level domain) two-character value. Most ccTLD
|
318
|
+
# codes are identical to ISO 3166-1 codes, with some exceptions. This parameter will only influence, not
|
319
|
+
# fully restrict, search results. If more relevant results exist outside of the specified region, they may
|
320
|
+
# be included. When this parameter is used, the country name is omitted from the resulting formatted_address
|
321
|
+
# for results in the specified region.
|
307
322
|
# @option options [String,Array<String>] :exclude ([])
|
308
323
|
# A String or an Array of <b>types</b> to exclude from results
|
309
324
|
#
|
@@ -334,6 +349,7 @@ module GooglePlaces
|
|
334
349
|
radius = options.delete(:radius) if with_radius
|
335
350
|
rankby = options.delete(:rankby)
|
336
351
|
language = options.delete(:language)
|
352
|
+
region = options.delete(:region)
|
337
353
|
types = options.delete(:types)
|
338
354
|
exclude = options.delete(:exclude) || []
|
339
355
|
retry_options = options.delete(:retry_options) || {}
|
@@ -350,6 +366,7 @@ module GooglePlaces
|
|
350
366
|
|
351
367
|
options[:location] = location.format if with_location
|
352
368
|
options[:radius] = radius if with_radius
|
369
|
+
options[:region] = region unless region.nil?
|
353
370
|
|
354
371
|
# Accept Types as a string or array
|
355
372
|
if types
|
@@ -1,15 +1,30 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GooglePlaces::Client do
|
4
|
-
let(:client) { GooglePlaces::Client.new(api_key) }
|
4
|
+
let(:client) { GooglePlaces::Client.new(api_key, client_options) }
|
5
|
+
let(:client_options) { {} }
|
5
6
|
let(:fake_spot) { Object.new }
|
6
7
|
|
7
|
-
before
|
8
|
-
|
8
|
+
before { allow(fake_spot).to receive(:place_id) { 1 } }
|
9
|
+
|
10
|
+
describe '::api_key' do
|
11
|
+
it 'should initialize with an api_key' do
|
12
|
+
expect(client.api_key).to eq(api_key)
|
13
|
+
end
|
9
14
|
end
|
10
15
|
|
11
|
-
|
12
|
-
|
16
|
+
describe '::options' do
|
17
|
+
it 'should initialize without options' do
|
18
|
+
expect(client.options).to eq({})
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'with options' do
|
22
|
+
let(:client_options) { {radius: 1000} }
|
23
|
+
|
24
|
+
it 'should initialize with options' do
|
25
|
+
expect(client.options).to eq(client_options)
|
26
|
+
end
|
27
|
+
end
|
13
28
|
end
|
14
29
|
|
15
30
|
describe '::spots' do
|
@@ -33,6 +48,15 @@ describe GooglePlaces::Client do
|
|
33
48
|
client.spots(lat, lng, detail: true)
|
34
49
|
end
|
35
50
|
end
|
51
|
+
|
52
|
+
context 'with options' do
|
53
|
+
let(:client_options) { {radius: 1000} }
|
54
|
+
let(:method_options) { {radius: 2000} }
|
55
|
+
it 'preserves client options while merging with method options' do
|
56
|
+
allow(GooglePlaces::Spot).to receive(:list).with(lat, lng, api_key, method_options)
|
57
|
+
expect { client.spots(lat, lng, method_options) }.not_to change(client, :options)
|
58
|
+
end
|
59
|
+
end
|
36
60
|
end
|
37
61
|
|
38
62
|
describe '::spot' do
|
@@ -41,16 +65,21 @@ describe GooglePlaces::Client do
|
|
41
65
|
expect(GooglePlaces::Spot).to receive(:find).with(place_id, api_key, {})
|
42
66
|
client.spot(place_id)
|
43
67
|
end
|
68
|
+
|
69
|
+
context 'with options' do
|
70
|
+
let(:client_options) { {language: 'en'} }
|
71
|
+
let(:method_options) { {language: 'es'} }
|
72
|
+
it 'preserves client options while merging with method options' do
|
73
|
+
allow(GooglePlaces::Spot).to receive(:find).with(place_id, api_key, method_options)
|
74
|
+
expect { client.spot(place_id, method_options) }.not_to change(client, :options)
|
75
|
+
end
|
76
|
+
end
|
44
77
|
end
|
45
78
|
|
46
79
|
describe '::spots_by_query' do
|
47
80
|
let(:query) { 'Statue of liberty, New York' }
|
48
81
|
it 'should request spots by query' do
|
49
|
-
expect(GooglePlaces::Spot).to receive(:list_by_query).with(
|
50
|
-
query,
|
51
|
-
api_key,
|
52
|
-
{}
|
53
|
-
)
|
82
|
+
expect(GooglePlaces::Spot).to receive(:list_by_query).with(query, api_key, {})
|
54
83
|
client.spots_by_query(query)
|
55
84
|
end
|
56
85
|
|
@@ -67,6 +96,15 @@ describe GooglePlaces::Client do
|
|
67
96
|
client.spots_by_query(query, detail: true)
|
68
97
|
end
|
69
98
|
end
|
99
|
+
|
100
|
+
context 'with options' do
|
101
|
+
let(:client_options) { {language: 'en'} }
|
102
|
+
let(:method_options) { {language: 'es'} }
|
103
|
+
it 'preserves client options while merging with method options' do
|
104
|
+
allow(GooglePlaces::Spot).to receive(:list_by_query).with(query, api_key, method_options)
|
105
|
+
expect { client.spots_by_query(query, method_options) }.not_to change(client, :options)
|
106
|
+
end
|
107
|
+
end
|
70
108
|
end
|
71
109
|
|
72
110
|
describe '::spots_by_bounds' do
|
@@ -79,10 +117,7 @@ describe GooglePlaces::Client do
|
|
79
117
|
end
|
80
118
|
|
81
119
|
it 'should request spots by bounds' do
|
82
|
-
expect(GooglePlaces::Spot).to receive(:list_by_bounds).with(
|
83
|
-
bounds, api_key,
|
84
|
-
query: query
|
85
|
-
)
|
120
|
+
expect(GooglePlaces::Spot).to receive(:list_by_bounds).with(bounds, api_key, query: query)
|
86
121
|
client.spots_by_bounds(bounds, query: query)
|
87
122
|
end
|
88
123
|
|
@@ -99,6 +134,32 @@ describe GooglePlaces::Client do
|
|
99
134
|
client.spots_by_bounds(bounds, query: query, detail: true)
|
100
135
|
end
|
101
136
|
end
|
137
|
+
|
138
|
+
context 'with options' do
|
139
|
+
let(:client_options) { {language: 'en'} }
|
140
|
+
let(:method_options) { {query: query, language: 'es'} }
|
141
|
+
it 'preserves client options while merging with method options' do
|
142
|
+
allow(GooglePlaces::Spot).to receive(:list_by_bounds).with(bounds, api_key, method_options)
|
143
|
+
expect { client.spots_by_bounds(bounds, method_options) }.not_to change(client, :options)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe '::spots_by_pagetoken' do
|
149
|
+
let(:pagetoken) { 'somepagetoken' }
|
150
|
+
it 'should request spots by pagetoken'do
|
151
|
+
expect(GooglePlaces::Spot).to receive(:list_by_pagetoken).with(pagetoken, api_key, {})
|
152
|
+
client.spots_by_pagetoken(pagetoken)
|
153
|
+
end
|
154
|
+
|
155
|
+
context 'with options' do
|
156
|
+
let(:client_options) { {retry_options: {max: 5}} }
|
157
|
+
let(:method_options) { {retry_options: {max: 10}} }
|
158
|
+
it 'preserves client options while merging with method options' do
|
159
|
+
allow(GooglePlaces::Spot).to receive(:list_by_pagetoken).with(pagetoken, api_key, method_options)
|
160
|
+
expect { client.spots_by_pagetoken(pagetoken, method_options) }.not_to change(client, :options)
|
161
|
+
end
|
162
|
+
end
|
102
163
|
end
|
103
164
|
|
104
165
|
describe '::spots_by_radar' do
|
@@ -108,13 +169,7 @@ describe GooglePlaces::Client do
|
|
108
169
|
let(:radius) { 5000 }
|
109
170
|
|
110
171
|
it 'should request spots by radar' do
|
111
|
-
expect(GooglePlaces::Spot).to receive(:list_by_radar).with(
|
112
|
-
lat,
|
113
|
-
lng,
|
114
|
-
api_key,
|
115
|
-
radius: radius,
|
116
|
-
keyword: keywords
|
117
|
-
)
|
172
|
+
expect(GooglePlaces::Spot).to receive(:list_by_radar).with(lat, lng, api_key, radius: radius, keyword: keywords)
|
118
173
|
client.spots_by_radar(lat, lng, radius: radius, keyword: keywords)
|
119
174
|
end
|
120
175
|
|
@@ -137,19 +192,33 @@ describe GooglePlaces::Client do
|
|
137
192
|
)
|
138
193
|
end
|
139
194
|
end
|
195
|
+
|
196
|
+
context 'with options' do
|
197
|
+
let(:client_options) { {radius: 1000} }
|
198
|
+
let(:method_options) { {radius: radius, keyword: keywords} }
|
199
|
+
it 'preserves client options while merging with method options' do
|
200
|
+
allow(GooglePlaces::Spot).to receive(:list_by_radar).with(lat, lng, api_key, method_options)
|
201
|
+
expect { client.spots_by_radar(lat, lng, method_options) }.not_to change(client, :options)
|
202
|
+
end
|
203
|
+
end
|
140
204
|
end
|
141
205
|
|
142
206
|
describe '::predictions_by_input' do
|
143
207
|
let(:input) { 'Atlanta' }
|
144
208
|
|
145
209
|
it 'should request predictions by input' do
|
146
|
-
expect(GooglePlaces::Prediction).to receive(:list_by_input).with(
|
147
|
-
input,
|
148
|
-
api_key,
|
149
|
-
{}
|
150
|
-
)
|
210
|
+
expect(GooglePlaces::Prediction).to receive(:list_by_input).with(input, api_key, {})
|
151
211
|
client.predictions_by_input(input)
|
152
212
|
end
|
213
|
+
|
214
|
+
context 'with options' do
|
215
|
+
let(:client_options) { {radius: 1000} }
|
216
|
+
let(:method_options) { {radius: 2000} }
|
217
|
+
it 'preserves client options while merging with method options' do
|
218
|
+
allow(GooglePlaces::Prediction).to receive(:list_by_input).with(input, api_key, method_options)
|
219
|
+
expect { client.predictions_by_input(input, method_options) }.not_to change(client, :options)
|
220
|
+
end
|
221
|
+
end
|
153
222
|
end
|
154
223
|
|
155
224
|
describe 'detailed spots', vcr: { cassette_name: 'list_spots_with_detail' } do
|
@@ -140,6 +140,20 @@ describe GooglePlaces::Spot do
|
|
140
140
|
@collection = GooglePlaces::Spot.list_by_query('Statue of liberty, New York', api_key)
|
141
141
|
end
|
142
142
|
|
143
|
+
it 'should include country in formatted address' do
|
144
|
+
@collection = GooglePlaces::Spot.list_by_query('Statue of liberty, New York', api_key, region: 'ca')
|
145
|
+
@collection.each do |spot|
|
146
|
+
expect(spot.formatted_address).to end_with('United States')
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'should not include country in formatted address' do
|
151
|
+
@collection = GooglePlaces::Spot.list_by_query('Statue of liberty, New York', api_key, region: 'us')
|
152
|
+
@collection.each do |spot|
|
153
|
+
expect(spot.formatted_address).to_not end_with('United States')
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
143
157
|
end
|
144
158
|
|
145
159
|
context 'List spots by radar', vcr: { cassette_name: 'list_spots_by_radar' } do
|
@@ -183,4 +197,16 @@ describe GooglePlaces::Spot do
|
|
183
197
|
end
|
184
198
|
end
|
185
199
|
end
|
200
|
+
|
201
|
+
context 'Find a single spot with region parameter', vcr: { cassette_name: 'single_spot' } do
|
202
|
+
it 'should include country name in formatted address' do
|
203
|
+
@spot = GooglePlaces::Spot.find(@place_id, api_key, region: 'nz')
|
204
|
+
expect(@spot.formatted_address).to end_with('Australia')
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'should not include country name in formatted address' do
|
208
|
+
@spot = GooglePlaces::Spot.find(@place_id, api_key, region: 'au')
|
209
|
+
expect(@spot.formatted_address).to_not end_with('Australia')
|
210
|
+
end
|
211
|
+
end
|
186
212
|
end
|
@@ -2318,4 +2318,184 @@ http_interactions:
|
|
2318
2318
|
}
|
2319
2319
|
http_version:
|
2320
2320
|
recorded_at: Tue, 07 Feb 2017 16:16:33 GMT
|
2321
|
+
- request:
|
2322
|
+
method: get
|
2323
|
+
uri: https://maps.googleapis.com/maps/api/place/textsearch/json?key=AIzaSyAKeN0XMV5LqJmqBrZZ1K8qMipFW7-Eybg&language=&query=Statue%20of%20liberty,%20New%20York&rankby=®ion=ca
|
2324
|
+
body:
|
2325
|
+
encoding: US-ASCII
|
2326
|
+
string: ''
|
2327
|
+
headers:
|
2328
|
+
Accept-Encoding:
|
2329
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
2330
|
+
Accept:
|
2331
|
+
- "*/*"
|
2332
|
+
User-Agent:
|
2333
|
+
- Ruby
|
2334
|
+
response:
|
2335
|
+
status:
|
2336
|
+
code: 200
|
2337
|
+
message: OK
|
2338
|
+
headers:
|
2339
|
+
Content-Type:
|
2340
|
+
- application/json; charset=UTF-8
|
2341
|
+
Date:
|
2342
|
+
- Wed, 24 Jan 2018 12:18:14 GMT
|
2343
|
+
Expires:
|
2344
|
+
- Wed, 24 Jan 2018 12:23:14 GMT
|
2345
|
+
Cache-Control:
|
2346
|
+
- public, max-age=300
|
2347
|
+
Vary:
|
2348
|
+
- Accept-Language
|
2349
|
+
Server:
|
2350
|
+
- scaffolding on HTTPServer2
|
2351
|
+
Content-Length:
|
2352
|
+
- '949'
|
2353
|
+
X-Xss-Protection:
|
2354
|
+
- 1; mode=block
|
2355
|
+
X-Frame-Options:
|
2356
|
+
- SAMEORIGIN
|
2357
|
+
Alt-Svc:
|
2358
|
+
- hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337;
|
2359
|
+
quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
|
2360
|
+
body:
|
2361
|
+
encoding: ASCII-8BIT
|
2362
|
+
string: |
|
2363
|
+
{
|
2364
|
+
"html_attributions" : [],
|
2365
|
+
"results" : [
|
2366
|
+
{
|
2367
|
+
"formatted_address" : "New York, NY, United States",
|
2368
|
+
"geometry" : {
|
2369
|
+
"location" : {
|
2370
|
+
"lat" : 40.6892494,
|
2371
|
+
"lng" : -74.04450039999999
|
2372
|
+
},
|
2373
|
+
"viewport" : {
|
2374
|
+
"northeast" : {
|
2375
|
+
"lat" : 40.71823,
|
2376
|
+
"lng" : -73.99872490000001
|
2377
|
+
},
|
2378
|
+
"southwest" : {
|
2379
|
+
"lat" : 40.6795892,
|
2380
|
+
"lng" : -74.05975889999998
|
2381
|
+
}
|
2382
|
+
}
|
2383
|
+
},
|
2384
|
+
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_recreational-71.png",
|
2385
|
+
"id" : "5a0d7e67078e35af0c456a277df9ffba7c1e4da6",
|
2386
|
+
"name" : "Statue of Liberty National Monument",
|
2387
|
+
"opening_hours" : {
|
2388
|
+
"open_now" : false,
|
2389
|
+
"weekday_text" : []
|
2390
|
+
},
|
2391
|
+
"photos" : [
|
2392
|
+
{
|
2393
|
+
"height" : 667,
|
2394
|
+
"html_attributions" : [
|
2395
|
+
"\u003ca href=\"https://maps.google.com/maps/contrib/114885487034263057803/photos\"\u003eManish Sharma\u003c/a\u003e"
|
2396
|
+
],
|
2397
|
+
"photo_reference" : "CmRZAAAApIdeJ7LZhzqa-SfazEF4feWIFXt09HK-g8xV90QE1Y7qkyjFdtiM7meBrsWZ_i_-2Wbr5LPNpoO4AMVpRNDjsZbh3yCGRuTvKU43rcKdX_31ktO-rDtNps9t23WOBiF4EhBWFUzvr4jjtQ--j5PHX9UXGhQ03NED1g5rdXui4yMazYKFiKKC-A",
|
2398
|
+
"width" : 1000
|
2399
|
+
}
|
2400
|
+
],
|
2401
|
+
"place_id" : "ChIJPTacEpBQwokRKwIlDXelxkA",
|
2402
|
+
"rating" : 4.6,
|
2403
|
+
"reference" : "CmRRAAAALN3WhgFKsd3Zwc8OuQZsFiKk3KYfwqd6jys7771vFQNoKFTwULh4l911ax0Sce1XywmtqFKoREYVaN6mzeqKD9SUa8bERwYQMtsCDYmSIBSZuOYQUVDOJdNBXZ49CsxgEhAgMeVxYVCP8AdoyXyoezmXGhTf5UmS27ih7GQL7Cnz44xlEHtx9A",
|
2404
|
+
"types" : [ "park", "point_of_interest", "establishment" ]
|
2405
|
+
}
|
2406
|
+
],
|
2407
|
+
"status" : "OK"
|
2408
|
+
}
|
2409
|
+
http_version:
|
2410
|
+
recorded_at: Wed, 24 Jan 2018 12:18:14 GMT
|
2411
|
+
- request:
|
2412
|
+
method: get
|
2413
|
+
uri: https://maps.googleapis.com/maps/api/place/textsearch/json?key=AIzaSyAKeN0XMV5LqJmqBrZZ1K8qMipFW7-Eybg&language=&query=Statue%20of%20liberty,%20New%20York&rankby=®ion=us
|
2414
|
+
body:
|
2415
|
+
encoding: US-ASCII
|
2416
|
+
string: ''
|
2417
|
+
headers:
|
2418
|
+
Accept-Encoding:
|
2419
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
2420
|
+
Accept:
|
2421
|
+
- "*/*"
|
2422
|
+
User-Agent:
|
2423
|
+
- Ruby
|
2424
|
+
response:
|
2425
|
+
status:
|
2426
|
+
code: 200
|
2427
|
+
message: OK
|
2428
|
+
headers:
|
2429
|
+
Content-Type:
|
2430
|
+
- application/json; charset=UTF-8
|
2431
|
+
Date:
|
2432
|
+
- Wed, 24 Jan 2018 12:18:15 GMT
|
2433
|
+
Expires:
|
2434
|
+
- Wed, 24 Jan 2018 12:23:15 GMT
|
2435
|
+
Cache-Control:
|
2436
|
+
- public, max-age=300
|
2437
|
+
Vary:
|
2438
|
+
- Accept-Language
|
2439
|
+
Server:
|
2440
|
+
- scaffolding on HTTPServer2
|
2441
|
+
Content-Length:
|
2442
|
+
- '939'
|
2443
|
+
X-Xss-Protection:
|
2444
|
+
- 1; mode=block
|
2445
|
+
X-Frame-Options:
|
2446
|
+
- SAMEORIGIN
|
2447
|
+
Alt-Svc:
|
2448
|
+
- hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337;
|
2449
|
+
quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
|
2450
|
+
body:
|
2451
|
+
encoding: ASCII-8BIT
|
2452
|
+
string: |
|
2453
|
+
{
|
2454
|
+
"html_attributions" : [],
|
2455
|
+
"results" : [
|
2456
|
+
{
|
2457
|
+
"formatted_address" : "New York, NY",
|
2458
|
+
"geometry" : {
|
2459
|
+
"location" : {
|
2460
|
+
"lat" : 40.6892494,
|
2461
|
+
"lng" : -74.04450039999999
|
2462
|
+
},
|
2463
|
+
"viewport" : {
|
2464
|
+
"northeast" : {
|
2465
|
+
"lat" : 40.71823,
|
2466
|
+
"lng" : -73.99872490000001
|
2467
|
+
},
|
2468
|
+
"southwest" : {
|
2469
|
+
"lat" : 40.6795892,
|
2470
|
+
"lng" : -74.05975889999998
|
2471
|
+
}
|
2472
|
+
}
|
2473
|
+
},
|
2474
|
+
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_recreational-71.png",
|
2475
|
+
"id" : "5a0d7e67078e35af0c456a277df9ffba7c1e4da6",
|
2476
|
+
"name" : "Statue of Liberty National Monument",
|
2477
|
+
"opening_hours" : {
|
2478
|
+
"open_now" : false,
|
2479
|
+
"weekday_text" : []
|
2480
|
+
},
|
2481
|
+
"photos" : [
|
2482
|
+
{
|
2483
|
+
"height" : 667,
|
2484
|
+
"html_attributions" : [
|
2485
|
+
"\u003ca href=\"https://maps.google.com/maps/contrib/114885487034263057803/photos\"\u003eManish Sharma\u003c/a\u003e"
|
2486
|
+
],
|
2487
|
+
"photo_reference" : "CmRZAAAAWX4o1rEMvvWFN4QMewxBGxi-aAFTY42528CaKXiwPa7emFYaj0Wg-9skfqkQehjf1xTTKQi7q5VrbMjmmAlpmABf8v6YRcaIbpZG6QWOXO70EnbrO0Eht2OS3bsplrmZEhAPAr0iUM2kcMJQcEYkL0eLGhQ71THLSgBL7YPwFtKCqWa3S4iUeA",
|
2488
|
+
"width" : 1000
|
2489
|
+
}
|
2490
|
+
],
|
2491
|
+
"place_id" : "ChIJPTacEpBQwokRKwIlDXelxkA",
|
2492
|
+
"rating" : 4.6,
|
2493
|
+
"reference" : "CmRRAAAAwPI8lLjxL_DyyktO_JdjvdEiNXho7mMyB8UMV3R904Un27yS5lqCT0ulfvPLF0uE2f87Ayosb34vZq0T23h9zxZ1H4oN4uASk7mOV0QlXldh2fm53mlgYcAkLy9Zr8kXEhDcmwk0tyU1rWCqJzRvtFArGhRXRyC-f_tRlJVmFTsDketKi0U1EA",
|
2494
|
+
"types" : [ "park", "point_of_interest", "establishment" ]
|
2495
|
+
}
|
2496
|
+
],
|
2497
|
+
"status" : "OK"
|
2498
|
+
}
|
2499
|
+
http_version:
|
2500
|
+
recorded_at: Wed, 24 Jan 2018 12:18:15 GMT
|
2321
2501
|
recorded_with: VCR 2.9.3
|