Skip to content

Instantly share code, notes, and snippets.

@zahodi
Created December 31, 2015 07:26
Show Gist options
  • Save zahodi/927e14fc1c74d565960e to your computer and use it in GitHub Desktop.
Save zahodi/927e14fc1c74d565960e to your computer and use it in GitHub Desktop.
wunderground
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
open('http://api.wunderground.com/api/key/geolookup/conditions/q/WA/Seattle.json') do |f|
json_string = f.read
parsed_json = JSON.parse(json_string)
location = parsed_json['location']['city']
temp_f = parsed_json['current_observation']['temp_f']
print "Current temperature in #{location} is: #{temp_f}\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment