Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uber-handler

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uber-handler - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

package-lock.json.1603753461

65

index.js

@@ -7,2 +7,3 @@ const Axios = require("axios");

this.token = config.token || "";
this.access_token = config.access_token || "";
this.sandbox = config.sandbox || false;

@@ -18,3 +19,3 @@ this.baseURL = this.sandbox

headers: {
Authorization: `Token ${this.token}`,
Authorization: `Bearer ${this.access_token}`,
"Content-Type": "application/json",

@@ -25,12 +26,12 @@ "Accept-Language": "en_US"

this.getMotorBikePrice = this.getMotorBikePrice.bind(this);
this.getRequestEstimate = this.getRequestEstimate.bind(this);
this.getDriverEstimatedTimeOfArrival = this.getDriverEstimatedTimeOfArrival.bind(
this
);
this.getRequestsEstimate = this.getRequestsEstimate.bind(this);
this.requestRide = this.requestRide.bind(this);
}
getMotorBikePrice(start = {}, end = {}) {
getRequestEstimate(start = {}, end = {}) {
const payload = {
product_id: this.uberMotorProductId,
start_latitude: start.lat,

@@ -42,17 +43,19 @@ start_longitude: start.long,

return this.axios
.get(`/estimates/price?${queryString.stringify(payload)}`)
.then(response => {
const uberMotor = response.data.prices.filter(
item => item.product_id == this.uberMotorProductId
)[0];
return this.axios.post(`/requests/estimate`, payload).then(response => {
const { data } = response;
return {
price: {
fixed: uberMotor.high_estimate == uberMotor.low_estimate,
high: uberMotor.high_estimate,
low: uberMotor.low_estimate
}
};
});
const price = {
high: data.estimate ? data.estimate.high_estimate : data.fare.value,
low: data.estimate ? data.estimate.low_estimate : data.fare.value
};
return {
price: {
...price,
fixed: price.high == price.low,
fare_id: data.fare.fare_id,
expires_at: data.fare.expires_at
}
};
});
}

@@ -76,22 +79,4 @@

getRequestsEstimate(auth, start = {}, end = {}) {
requestRide(fare_id, start = {}, end = {}) {
const payload = {
product_id: this.uberMotorProductId,
start_latitude: start.lat,
start_longitude: start.long,
end_latitude: end.lat,
end_longitude: end.long
};
return this.axios
.post("/requests/estimate", payload, {
headers: {
Authorization: `Bearer ${auth}`
}
})
.then(response => response.data);
}
requestRide(auth, fare_id, start = {}, end = {}) {
const payload = {
fare_id,

@@ -106,9 +91,5 @@ product_id: this.uberMotorProductId,

return this.axios
.post("/requests", payload, {
headers: {
Authorization: `Bearer ${auth}`
}
})
.post("/requests", payload)
.then(response => response.data);
}
};
{
"name": "uber-handler",
"version": "0.3.0",
"version": "0.3.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc