uber-handler
Advanced tools
+23
-3
@@ -8,2 +8,4 @@ const Axios = require("axios"); | ||
| this.uberMotorProductId = "89da0988-cb4f-4c85-b84f-aac2f5115068"; | ||
| this.axios = Axios.create({ | ||
@@ -19,5 +21,8 @@ baseURL: "https://api.uber.com/v1.2", | ||
| this.getMotorBikePrice = this.getMotorBikePrice.bind(this); | ||
| this.getDriverEstimatedTimeOfArrival = this.getDriverEstimatedTimeOfArrival.bind( | ||
| this | ||
| ); | ||
| } | ||
| getMotorBikePrice(start, end) { | ||
| getMotorBikePrice(start = {}, end = {}) { | ||
| const payload = { | ||
@@ -33,5 +38,4 @@ start_latitude: start.lat, | ||
| .then(response => { | ||
| const uberMotorProductId = "89da0988-cb4f-4c85-b84f-aac2f5115068"; //uberMotor | ||
| const uberMotor = response.data.prices.filter( | ||
| item => item.product_id == uberMotorProductId | ||
| item => item.product_id == this.uberMotorProductId | ||
| )[0]; | ||
@@ -48,2 +52,18 @@ | ||
| } | ||
| getDriverEstimatedTimeOfArrival(start = {}) { | ||
| const payload = { | ||
| start_latitude: start.lat, | ||
| start_longitude: start.long, | ||
| product_id: this.uberMotorProductId | ||
| }; | ||
| return this.axios | ||
| .get(`/estimates/time?${queryString.stringify(payload)}`) | ||
| .then(response => { | ||
| return { | ||
| estimate: response.data.times[0].estimate | ||
| }; | ||
| }); | ||
| } | ||
| }; |
+2
-2
| { | ||
| "name": "uber-handler", | ||
| "version": "0.1.3", | ||
| "version": "0.2.0", | ||
| "description": "", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1", | ||
| "release": "np" | ||
@@ -17,4 +16,5 @@ }, | ||
| "devDependencies": { | ||
| "dotenv": "^4.0.0", | ||
| "np": "^2.16.0" | ||
| } | ||
| } |
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
2152
30.19%56
43.59%2
-33.33%2
100%