Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "ukdomino", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "ukdomino module js", | ||
"main": "src/index.js", | ||
"directories": {}, | ||
"scripts": { | ||
"test": "npm run" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/rossAPI/ukdomino.git" | ||
"url": "git+https://github.com/rossAPi/ukdomino.git" | ||
}, | ||
@@ -22,7 +25,10 @@ "keywords": [ | ||
"dependencies": { | ||
"angular": "^1.7.7", | ||
"fs": "0.0.1-security", | ||
"node-fetch": "^2.3.0", | ||
"path": "^0.12.7", | ||
"util": "^0.11.1" | ||
"superagent": "^4.1.0", | ||
"util": "^0.11.1", | ||
"xmlhttprequest": "^1.8.0" | ||
} | ||
} |
# UKDOMINO NODE.JS MODULE | ||
<img src="https://npm.packagequality.com/badge/ukdomino.png"/> | ||
[![Join the chat at https://gitter.im/ukdomino/community](https://badges.gitter.im/ukdomino/community.svg)](https://gitter.im/ukdomino/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
In this module, the Dominos API is used to create features in Javascript, such as getMenu (for any store) and ordering (W.I.P. AS OF 18/02/2019). This module is for the UK-only; I HIGHLY recommend [this module](https://www.npmjs.com/package/dominos "DOMINO USA MODULE") for people in the USA (NPM link). This project is licensed under [the MIT license](https://choosealicense.com/licenses/mit/ "the MIT license"). | ||
@@ -7,3 +12,3 @@ | ||
### Prerequisites and Instaling | ||
### Prerequisites and Installing | ||
You will need to [install Node-JS](https://nodejs.org/en/download/install "Node-JS") and my package by using the following line below; | ||
@@ -34,6 +39,10 @@ | ||
-> node-fetch, used to fetch JSON data. https://www.npmjs.com/package/node-fetch | ||
-> fs, used to write file systems. https://nodejs.org/api/fs.html | ||
-> path, joining paths etc. https://www.npmjs.com/package/path | ||
-> util, sync with fs. https://www.npmjs.com/package/util | ||
Apologies for anything I have forgot; I can add on request. | ||
@@ -47,3 +56,3 @@ | ||
* **Ross Hamilton** - *Main Scripting* - [rossAPi]https://github.com/rossAPi | ||
* **Ross Hamilton** - *Main Scripting* - [rossAPi](https://github.com/rossAPi "User") | ||
@@ -64,2 +73,2 @@ | ||
## DOCS: | ||
-> COMING SOON | ||
-> See the [wiki here.](https://github.com/rossAPi/ukdomino/wiki) |
@@ -10,10 +10,3 @@ | ||
// TABLE OF THINGS ADDED TO BASKET ETC. | ||
var store = ""; | ||
var localStore = null; | ||
var basket = []; | ||
// FIND LOCAL STORE | ||
@@ -38,3 +31,3 @@ | ||
exports.localStoreOpen = function(postcode) { | ||
exports.storeOpen = function(postcode) { | ||
// get the local store | ||
@@ -59,77 +52,4 @@ // get the api and find with the postcode provided | ||
exports.setStore = function(postcode) { | ||
// if asked for local store, find it. | ||
// if given the store postcode, use that. | ||
// fetch the api | ||
return fetch('https://www.dominos.co.uk/storefindermap/storesearch?SearchText=' + postcode) | ||
// json the data | ||
.then(res => res.json()) | ||
// return and set appropiately | ||
.then(function(json) { | ||
// return console.log(json.localStore.postcode) | ||
// check if store exists (if does set to store, if not throw a controlled error) | ||
store = json.localStore.postcode | ||
// removes whitespaces | ||
store = store.replace(/\s/g, '') | ||
// console.log(store) | ||
console.warn("ukdomino status: Postcode value updated.") | ||
}) .catch (err => console.log("ukdomino error: " + err)) | ||
} | ||
exports.addPizzaToBasket = function(pizza, variant="VARIANT.MEDIUM", quantity=1) { | ||
// adds pizza item to "basket" table, ready for ordering. | ||
// systems can be made to log the "basket" in a file, ready to be picked up later, OR by using the saveBasket() function (RECOMMENDED). | ||
// make an array to be added to the basket array | ||
// TO ADD: MAJOR IMPORTANT: ADD ITEM ID FROM ITEM | ||
// array for all arguments | ||
pizza = ["pizza", "stepId: 0", "quantity: " + quantity, "sizeId: " + variant, "productId: " + pizza, "ingredients: [36, 42]", "productIdHalfTwo: 0", "ingredientsHalfTwo: []" , "recipeReferrer: " + 0] | ||
// adds to the end of the list | ||
basket.push(pizza) | ||
// console.log(basket[0]) | ||
} | ||
exports.addSideToBasket = function(side, quantity) { | ||
// adds side item to "basket" table, ready for ordering, | ||
// systems can be made to log the "basket" in a file, ready to be picked up later, OR by using the saveBasket() function (RECOMMENDED). | ||
// make an array to be added to the basket array | ||
// TO ADD: MAJOR IMPORTANT: ADD ITEM ID FROM ITEM | ||
// array for all required arguments | ||
side = ["side", "productSkuId: " + side] | ||
} | ||
exports.saveBasket = function(location="./") { | ||
// saves basket to location OR (default) in the folder | ||
// try the location and create the basketFile, made not a TXT to prevent unwanted editing. | ||
// make a variable of the basket that allows it to be put on the next line | ||
var locationLine = path.join(location, "basket") | ||
fs.writeFile(locationLine, basket, function (err) { | ||
if (err) return console.log("ukdomino error: (No file or directory) Formal " + err) | ||
console.log('ukdomino status: Basket was saved.') | ||
}) | ||
} | ||
var resultHandler = function(err) { | ||
if(err) { | ||
console.log("ukdomino error: (No file or directory Formal " + err) | ||
} else { | ||
console.log('ukdomino status: Basket was cleared/deleted.') | ||
} | ||
} | ||
exports.clearBasket = function(location = "./") { | ||
// removes all data from the basket | ||
// if del = true then delete the basket file as well | ||
// if del = false then remove just the data | ||
var locationLine = path.join(location, "basket") | ||
fs.unlink(locationLine, resultHandler, function () { | ||
resultHandler() | ||
}) | ||
} | ||
exports.getMenu = function(collectionOnly, menuVersion, storeId) { | ||
@@ -136,0 +56,0 @@ // gets the menu for the store requested. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
11135
12
0
71
3
7
63
+ Addedangular@^1.7.7
+ Addedsuperagent@^4.1.0
+ Addedxmlhttprequest@^1.8.0
+ Addedangular@1.8.3(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcookiejar@2.1.4(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedform-data@2.5.2(transitive)
+ Addedformidable@1.2.6(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.1.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@2.6.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.1.3(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedqs@6.13.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedsuperagent@4.1.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxmlhttprequest@1.8.0(transitive)