Skip to content

Instantly share code, notes, and snippets.

@coderforhire
Created May 11, 2012 18:15
Show Gist options
  • Save coderforhire/2661465 to your computer and use it in GitHub Desktop.
Save coderforhire/2661465 to your computer and use it in GitHub Desktop.
desc "Fetch weather"
task :fetch_weather => :environment do
require 'nokogiri'
require 'open-uri'
@weathers = Weather.all
@weathers.each do |weather|
url = "URL.com/1w.xml?location=#{weather.zip}"
puts url
doc = Nokogiri::HTML(open(url))
#weather.update_attribute(:humidity, humidity)
puts doc
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment