Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
provide rankby and secure parameter to the place API call + validate …
Browse files Browse the repository at this point in the history
…argument a little bit better
  • Loading branch information
fabriziomoscon committed Apr 3, 2013
1 parent 6bc769b commit f371299
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
36 changes: 29 additions & 7 deletions lib/googlemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,41 @@ exports.config = config = function(key, value) {
};

// http://code.google.com/apis/maps/documentation/places/
exports.places = function(latlng, radius, key, callback, sensor, types, lang, name) {
exports.places = function(latlng, radius, key, callback, sensor, types, lang, name, rankby, secure) {

var args = {
location: latlng,
radius: radius,
key: key
};
if (types) args.types = types;
if (lang) args.lang = lang;
if (name) args.name = name;

if (typeof rankby !== "undefined" && rankby !== null) {
args.rankby = rankby;
} else {
if (typeof radius !== "undefined" && radius !== null) {
args.radius = radius;
}
}

secure = secure || true
if (!(secure in [true, false])) {
secure = true;
}

if (typeof types !== "undefined" && types !== null) {
args.types = types;
}

if (typeof lang !== "undefined" && lang !== null) {
args.lang = lang;
}

if (typeof name !== "undefined" && name !== null) {
args.name = name;
}

args.sensor = sensor || 'false';

var path = '/maps/api/place/search/json';
return makeRequest(path, args, true, returnObjectFromJSON(callback));
return makeRequest('/maps/api/place/search/json', args, secure, returnObjectFromJSON(callback));
};

exports.placeDetails = function(referenceId, key, callback, sensor, lang) {
Expand Down

0 comments on commit f371299

Please sign in to comment.