diff --git a/README.md b/README.md index 8ff0e77..7b813ea 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ var places = new GooglePlaces('YOUR_API_KEY'); places.search({keyword: 'Vermonster'}, function(err, response) { console.log("search: ", response.results); - places.details({reference: response.results[0].reference}, function(err, response) { + places.details({placeid: response.results[0].place_id}, function(err, response) { console.log("search details: ", response.result.website); // search details: http://www.vermonster.com/ }); @@ -37,7 +37,7 @@ places.autocomplete({input: 'Verm', types: "(cities)"}, function(err, response) }; for(var index in response.predictions) { - places.details({reference: response.predictions[index].reference}, success); + places.details({placeid: response.predictions[index].place_id}, success); } }); ``` diff --git a/examples/lookup.js b/examples/lookup.js index bc59b1f..5d19250 100644 --- a/examples/lookup.js +++ b/examples/lookup.js @@ -9,7 +9,7 @@ places.search({keyword: 'Vermonster'}, function(err, response) { if(err) { console.log(err); return; } console.log("search: ", response.results); - places.details({reference: response.results[0].reference}, function(err, response) { + places.details({placeid: response.results[0].place_id}, function(err, response) { if(err) { console.log(err); return; } console.log("search details: ", response.result.website); }); @@ -25,6 +25,6 @@ places.autocomplete({input: 'Verm', types: "(cities)"}, function(err, response) }; for(var index in response.predictions) { - places.details({reference: response.predictions[index].reference}, success); + places.details({placeid: response.predictions[index].place_id}, success); } }); diff --git a/lib/google-places.js b/lib/google-places.js index 2c4a5e7..3ed3510 100644 --- a/lib/google-places.js +++ b/lib/google-places.js @@ -31,7 +31,6 @@ GooglePlaces.prototype.search = function(options, cb) { options = _.defaults(options, { location: [42.3577990, -71.0536364], radius: 10, - sensor: false, language: 'en', rankby: 'prominence', types: [] @@ -53,7 +52,6 @@ GooglePlaces.prototype.search = function(options, cb) { GooglePlaces.prototype.autocomplete = function(options, cb) { options = _.defaults(options, { language: "en", - sensor: false }); this._doRequest(this._generateUrl(options, 'autocomplete'), cb); @@ -62,8 +60,7 @@ GooglePlaces.prototype.autocomplete = function(options, cb) { // Goolge place details GooglePlaces.prototype.details = function(options, cb) { options = _.defaults(options, { - reference: options.reference, - sensor: false, + placeid: options.placeid, language: 'en' }); diff --git a/test/index.test.js b/test/index.test.js index f7637e0..a995837 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -7,17 +7,17 @@ fakeweb.allowNetConnect = false; // fake the search fakeweb.registerUri({ - uri: 'https://maps.googleapis.com/maps/api/place/search/json?location=42.357799%2C-71.0536364&radius=10&sensor=false&language=en&rankby=prominence&key=fake_key', + uri: 'https://maps.googleapis.com/maps/api/place/search/json?location=42.357799%2C-71.0536364&radius=10&language=en&rankby=prominence&key=fake_key', body: '{"results" : [{"name": "Vermonster", "id":"1"}], "status" : "OK"}' }); // fake the autocomplete fakeweb.registerUri({ - uri: 'https://maps.googleapis.com/maps/api/place/autocomplete/json?language=en&sensor=false&key=fake_key', + uri: 'https://maps.googleapis.com/maps/api/place/autocomplete/json?language=en&key=fake_key', body: '{"predictions" : [{"description": "Vermonster", "id":"1"}, {"description": "Vermont", "id":"2"}, {"description": "Vermilion", "id": "3"}], "status" : "OK"}' }); //fake the details fakeweb.registerUri({ - uri: 'https://maps.googleapis.com/maps/api/place/details/json?reference=ABC123&sensor=false&language=en&key=fake_key', + uri: 'https://maps.googleapis.com/maps/api/place/details/json?placeid=ABC123&language=en&key=fake_key', body: '{"result" : {"rating": 2.5}, "status" : "OK"}' }); @@ -83,7 +83,7 @@ vows.describe('Places autocomplete').addBatch({ vows.describe('Place details').addBatch({ 'new search': { topic: function() { - new GooglePlaces('fake_key').details({reference: 'ABC123'}, this.callback); + new GooglePlaces('fake_key').details({placeid: 'ABC123'}, this.callback); }, 'should get details': function(err, response){ assert.equal(response.result.rating, 2.5);