-
Notifications
You must be signed in to change notification settings - Fork 33
/
findStore.js
40 lines (35 loc) · 1.09 KB
/
findStore.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var pizzapi = require('dominos');
var prompt = require('prompt');
var myStore;
prompt.start();
prompt.get(['zip'], function (err, result) {
if (err) { return onErr(err); }
//Get stores by postal code, distance is not as accurate this way
pizzapi.Util.findNearbyStores(
result.zip,
'Delivery',
function(storeData) {
myStore = new pizzapi.Store(
{
ID: storeData.result.Stores[0].StoreID
}
);
//Get Info for first store
myStore.getInfo(
function(storeData) {
console.log('\n\n##################\nClosest Store Info\n##################\n\n',storeData.result);
}
);
//Get Menu for first store
myStore.getFriendlyNames(
function(storeData) {
console.log('\n\n##################\nClosest Store Menu\n##################\n\n',storeData.result);
}
);
}
);
});
function onErr(err) {
console.log(err);
return 1;
}