Skip to content

Commit

Permalink
added city and zip methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallen23 committed Apr 2, 2012
1 parent 8eb725a commit db33793
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
@@ -1,4 +1,4 @@
test:
./node_modules/.bin/nodeunit test/node.js
./node_modules/.bin/nodeunit test/placefinder.test.js

.PHONY: test
9 changes: 9 additions & 0 deletions lib/placefinder.js
Expand Up @@ -27,4 +27,13 @@ PlaceFinder.prototype.placeOfInterest = function(name, callback) {
PlaceFinder.prototype.woeid = function(woeid, callback) {
this._makeRequest({ woeid: woeid }, callback);
};

PlaceFinder.prototype.city = function(city, callback) {
this._makeRequest({ city: city }, callback);
};

PlaceFinder.prototype.zip = function(zip, callback) {
this._makeRequest({ postal: zip }, callback);
};

module.exports = PlaceFinder;
19 changes: 19 additions & 0 deletions tests/placefinder.test.js → test/placefinder.test.js
Expand Up @@ -26,3 +26,22 @@ exports.woeid = function(t) {
t.done();
});
};

exports.city = function(t) {
var pf = new PlaceFinder(appID);
var city = "Hermosa B";
pf.city(city, function(err, data) {
t.equal(data.ResultSet.Found, 1);
t.equal(data.ResultSet.Results[0].city, "Hermosa Beach");
t.done();
});
};

exports.zip = function(t) {
var pf = new PlaceFinder(appID);
var zip = "90254";
pf.zip(zip, function(err, data) {
t.equal(data.ResultSet.Results[0].city, "Hermosa Beach");
t.done();
});
};

0 comments on commit db33793

Please sign in to comment.