Last active
August 29, 2015 14:08
-
-
Save jaimerodas/abac52c0c49f80b9cdfd to your computer and use it in GitHub Desktop.
Scriptsito para decirme los precios de Uber
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hay que poner posición actual en
posy unserver_tokenválido. Hecho después de ver https://gist.github.com/holman/55130df8c9ba9fbce085