Class: Lcms::Engine::MaterialPreviewGenerator
- Inherits:
-
Object
- Object
- Lcms::Engine::MaterialPreviewGenerator
- Defined in:
- app/services/lcms/engine/material_preview_generator.rb
Overview
Generates and uploads PDF/GDoc files for material
Constant Summary collapse
- GDOC_RE =
%r{docs.google.com/document/d/([^/]*)}i.freeze
- GDOC_BROKEN_RE =
%r{/open\?id=$}i.freeze
- PDF_S3_FOLDER =
'temp-materials-pdf'
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(material, options = {}) ⇒ MaterialPreviewGenerator
constructor
A new instance of MaterialPreviewGenerator.
- #perform ⇒ Object
Constructor Details
#initialize(material, options = {}) ⇒ MaterialPreviewGenerator
Returns a new instance of MaterialPreviewGenerator.
15 16 17 18 |
# File 'app/services/lcms/engine/material_preview_generator.rb', line 15 def initialize(material, = {}) @material = material @options = end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
13 14 15 |
# File 'app/services/lcms/engine/material_preview_generator.rb', line 13 def error @error end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
13 14 15 |
# File 'app/services/lcms/engine/material_preview_generator.rb', line 13 def url @url end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/services/lcms/engine/material_preview_generator.rb', line 20 def perform return false unless assign_document [:type] == :pdf ? generate_pdf : generate_gdoc rescue StandardError => e @error = e. false end |