Class: Decidim::OpenDataJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Decidim::OpenDataJob
- Defined in:
- decidim-core/app/jobs/decidim/open_data_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(organization, resource = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'decidim-core/app/jobs/decidim/open_data_job.rb', line 7 def perform(organization, resource = nil) path = Rails.root.join("tmp/#{organization.open_data_file_path(resource)}") exporter = OpenDataExporter.new(organization, path, resource) raise "Could not generate Open Data export" unless exporter.export.positive? organization.open_data_files.attach(io: File.open(path, "rb"), filename: organization.open_data_file_path(resource)) # Deletes the temporary file file File.delete(path) end |