class Gtin2atc::BagDownloader
Public Instance Methods
download()
click to toggle source
# File lib/gtin2atc/downloader.rb, line 126 def download file = File.join(WorkDir, 'XMLPublications.zip') Gtin2atc.log "BagDownloader #{__LINE__}: #{file} from #{@url}" if File.exists?(file) and diff_hours = ((Time.now-File.ctime(file)).to_i/3600) and diff_hours < 24 Util.debug_msg "Skip download of #{file} as only #{diff_hours} hours old" else FileUtils.rm_f(file, :verbose => false) begin response = @agent.get(@url) response.save_as(file) response = nil # win rescue Timeout::Error, Errno::ETIMEDOUT retrievable? ? retry : raise ensure Gtin2atc.download_finished(file) end end content = read_xml_from_zip(/Preparations.xml/, File.join(Util.get_archive, File.basename(file))) content end
init()
click to toggle source
Calls superclass method
Gtin2atc::Downloader#init
# File lib/gtin2atc/downloader.rb, line 119 def init super @url ||= 'http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip' end
origin()
click to toggle source
# File lib/gtin2atc/downloader.rb, line 123 def origin @url end