Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Created February 11, 2014 23:25
Show Gist options
  • Save ttscoff/8946551 to your computer and use it in GitHub Desktop.
Save ttscoff/8946551 to your computer and use it in GitHub Desktop.
Forecast IO
#!/usr/bin/ruby
require 'rubygems'
require 'forecast_io'
ForecastIO.api_key = 'xxxxxxxxxxxxxxxxxx'
forecast = ForecastIO.forecast(44.047889,-91.640439)
if ARGV[0] == "current"
print "#{forecast.currently.temperature.round}, #{forecast.currently.summary}"
else
print forecast.minutely.summary
end
@EvanLovely
Copy link

Thanks! Here's what I had it print:

print forecast.daily.summary
print "\n"
print forecast.hourly.summary
print "\n"
print forecast.minutely.summary
print "\n"
print "Visibility: "
print forecast.currently.visibility
print " miles"

which currently outputs this:

Rain throughout the week; temperatures peaking at 51° on Thursday.
Light rain later this evening.
Light rain for the hour.
Visibility: 8.23 miles

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