2012-05-08 03:31:35 +00:00
|
|
|
class NccuCalendar
|
2012-05-08 08:08:41 +00:00
|
|
|
require 'open-uri'
|
2012-05-15 06:03:54 +00:00
|
|
|
require 'tempfile'
|
|
|
|
|
2012-05-08 03:31:35 +00:00
|
|
|
@queue = :high
|
|
|
|
|
|
|
|
def self.perform()
|
2012-05-15 06:03:54 +00:00
|
|
|
temp_file = Tempfile.new('new_cal')
|
|
|
|
temp_file << open('http://events.nccu.edu.tw/Month').read
|
|
|
|
|
|
|
|
FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml'))
|
|
|
|
|
2012-05-08 08:08:41 +00:00
|
|
|
puts "NccuCalendar Synced"
|
2012-05-08 03:31:35 +00:00
|
|
|
end
|
|
|
|
end
|