Orbit/app/jobs/nccu_calendar.rb

16 lines
335 B
Ruby

class NccuCalendar
require 'open-uri'
require 'tempfile'
@queue = :high
def self.perform()
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'))
puts "NccuCalendar Synced"
end
end