Class: Lcms::Engine::MaterialParseJob

Inherits:
ApplicationJob
  • Object
show all
Includes:
ResqueJob
Defined in:
app/jobs/lcms/engine/material_parse_job.rb

Instance Method Summary collapse

Methods included from ResqueJob

included, #result_key, #store_initial_result, #store_result

Instance Method Details

#perform(entry, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'app/jobs/lcms/engine/material_parse_job.rb', line 12

def perform(entry, options = {})
  attrs = attributes_for entry
  form = MaterialForm.new(attrs, import_retry: true)
  res = if form.save
          { ok: true, link: attrs[:link], model: form.material }
        else
          { ok: false, link: attrs[:link], errors: form.errors[:link] }
        end
  store_result res, options
end