Created
November 27, 2013 04:47
-
-
Save beathyate/7670794 to your computer and use it in GitHub Desktop.
Convertidor simple
This file contains 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 | |
require 'open-uri' | |
require 'json' | |
FROM = 'USD' | |
TO = 'PEN' | |
URL = "http://rate-exchange.appspot.com/currency?from=#{ FROM }&to=#{ TO }" | |
open URL do |rates_file| | |
hash = JSON.parse rates_file.string | |
puts hash['rate'].to_f * ARGV.first.to_f | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment