Class: Decidim::ExportParticipatorySpaceJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
decidim-core/app/jobs/decidim/export_participatory_space_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(user, participatory_space, name, format) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'decidim-core/app/jobs/decidim/export_participatory_space_job.rb', line 7

def perform(user, participatory_space, name, format)
  export_manifest = participatory_space.manifest.export_manifests.find do |manifest|
    manifest.name == name.to_sym
  end

  collection = export_manifest.collection.call(participatory_space)
  serializer = export_manifest.serializer

  export_data = Decidim::Exporters.find_exporter(format).new(collection, serializer).export

  Decidim::ExportMailer.export(user, name, export_data).deliver_now
end