Sha256: b046e1075a64b3fa9266839755b6ea31db09c5b448d1d7d559004da159ce1531
Contents?: true
Size: 1.05 KB
Versions: 16
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Lcms module Engine class MaterialGenerateGdocJob < Lcms::Engine::ApplicationJob include ResqueJob include RetryDelayed queue_as :default def perform(material, document) return if material.pdf? material = DocumentGenerator.material_presenter.new( material, document: DocumentGenerator.document_presenter.new(document) ) # Check if material is optional for current document options = {}.tap do |x| x[:prefix] = 'optional-' if material.optional_for?(document) end gdoc = DocumentExporter::Gdoc::Material.new(material, options).export new_links = { 'materials' => { material.id.to_s => { 'gdoc' => gdoc.url } } } document.with_lock do links = document.reload.links document.update links: links.deep_merge(new_links) end Lcms::Engine::DocumentGenerateJob.perform_later(document, check_queue: true) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems