Skip to content

Instantly share code, notes, and snippets.

@holman holman/example.png
Created Nov 5, 2014

Embed
What would you like to do?
A quick Hubot script to display Uber surge pricing from a particular point (LIKE AN OFFICE).
# Description
# Uber surge pricing magic checker.
#
# Commands:
# hubot uber me - Show the surge pricing information from the SF office.
Table = require 'cli-table'
module.exports = (robot) ->
robot.respond /uber me/i, (msg) ->
params =
'server_token': "#{process.env.HUBOT_UBER_TOKEN}"
'start_latitude': 37.782093 # this'll take you from the GitHub office, sooooo
'start_longitude': -122.391580 # your mileage (haha good one holman!) may vary
'end_latitude': 37.786959
'end_longitude': -122.397803
msg.http("https://api.uber.com/v1/estimates/price").query(params).get() (err, res, body) ->
table = new Table
head: ['phat ride', 'surge pricing'],
style: { head: false, border: [] }
json = JSON.parse(body)
for product in json["prices"]
table.push [product["display_name"], product["surge_multiplier"]]
msg.send "#{table}"
@fwenzel

This comment has been minimized.

Copy link

fwenzel commented Nov 5, 2014

YMMV - I see what you did there

@maxbeatty

This comment has been minimized.

Copy link

maxbeatty commented Nov 7, 2014

I really liked this idea so I fleshed it out a bit

https://github.com/maxbeatty/hubot-uber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.