Skip to content

Instantly share code, notes, and snippets.

@jaimerodas
Last active August 29, 2015 14:08
Show Gist options
  • Save jaimerodas/abac52c0c49f80b9cdfd to your computer and use it in GitHub Desktop.
Save jaimerodas/abac52c0c49f80b9cdfd to your computer and use it in GitHub Desktop.
Scriptsito para decirme los precios de Uber
#! /usr/bin/env ruby
begin
require 'httparty'
require 'json'
end
pos = {lat: 0.00, lon: 0.00}
datos = {
server_token: "tu_server_token",
start_latitude: pos[:lat],
start_longitude: pos[:lon],
end_latitude: pos[:lat] + 0.001,
end_longitude: pos[:lon] + 0.001
}
response = HTTParty.get("http://api.uber.com/v1/estimates/price", {:query => datos})
response = JSON.parse(response.body)
response["prices"].each do |tipo|
puts "#{tipo['localized_display_name']}: #{tipo['surge_multiplier']}X (Min: #{tipo['currency_code']}#{tipo['estimate']})"
end
@jaimerodas
Copy link
Author

Hay que poner posición actual en pos y un server_token válido. Hecho después de ver https://gist.github.com/holman/55130df8c9ba9fbce085

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment