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/local/bin/ruby | |
require "open-uri" | |
require "json" | |
open("http://api.wunderground.com/api/AP_KEY/conditions/bestfct:1/q/pws:KNYSCHEN27.json") do |f| | |
now = JSON.parse(f.read)["current_observation"] | |
forecast = now.values_at(*%w(weather temp_f relative_humidity wind_mph feelslike_f)) | |
forecast.map! { |f| f.respond_to?(:downcase) ? f.downcase : f } |