This repository has been archived by the owner on Apr 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Uber
Yuri Schimke edited this page Jul 18, 2018
·
12 revisions
https://github.com/yschimke/okurl/blob/master/commands/uberprices
$ uberprices buckingham palace
show(staticMap(loc, dest, route?.routes?.firstOrNull()?.geometry))
val prices = query<UberPriceEstimates>("https://api.uber.com/v1.2/estimates/price?start_latitude=${loc.latitude}&start_longitude=${loc.longitude}&end_latitude=${dest.latitude}&end_longitude=${dest.longitude}")
val times = query<UberTimeEstimates>("https://api.uber.com/v1.2/estimates/time?start_latitude=${loc.latitude}&start_longitude=${loc.longitude}&end_latitude=${dest.latitude}&end_longitude=${dest.longitude}")
for (price in prices.prices) {
val time = times.times.find { it.productId == price.productId }
val timeEstimate = time?.estimate?.let { "${it / 60} min" } ?: "Unknown"
println(price.localizedDisplayName.padEnd(15) + "\t" + timeEstimate.padEnd(15) + "\t" + price.estimate);
}
$ okurl 'https://api.uber.com/v1/products?latitude=37.8&longitude=-122.2' | jq .
{
"products": [
{
"capacity": 4,
"product_id": "04a497f5-380d-47f2-bf1b-ad4cfdcb51f2",
"price_details": {
"service_fees": [
{
"fee": 1.55,
"name": "Booking fee"
}
],
"cost_per_minute": 0.15,
"distance_unit": "mile",
"minimum": 6.55,
"cost_per_distance": 0.85,
"base": 1.5,
"cancellation_fee": 5,
"currency_code": "USD"
},
"image": "http://d1a3f4spazzrp4.cloudfront.net/car-types/mono/mono-uberx.png",
"shared": false,
"short_description": "uberX",
"display_name": "uberX",
"description": "uberX"
},