Class: PrepareDownloadJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/prepare_download_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(model_id:, selection:) ⇒ Object



5
6
7
8
9
10
11
# File 'app/jobs/prepare_download_job.rb', line 5

def perform(model_id:, selection:)
  @model = Model.find(model_id)
  @downloader = ArchiveDownloadService.new(model: @model, selection: selection)
  write_archive(@downloader.temp_file, file_list(@model, selection))
  FileUtils.mv(@downloader.temp_file, @downloader.output_file)
  @model.broadcast_refresh
end