Class: CanvasSync::Jobs::ReportProcessorJob

Inherits:
CanvasSync::Job
  • Object
show all
Defined in:
lib/canvas_sync/jobs/report_processor_job.rb

Overview

ActiveJob class that wraps around a report processor. This job will download the report, and then pass the file path and options into the process method on the processor.

Instance Attribute Summary

Attributes inherited from CanvasSync::Job

#job_log

Instance Method Summary collapse

Methods inherited from CanvasSync::Job

#create_job_log, #report_checker_wait_time, #update_or_create_model

Instance Method Details

#perform(report_name, report_url, processor, options, report_id) ⇒ nil

Parameters:

  • report_name (Hash)

    e.g., ‘provisioning_csv’

  • report_url (String)
  • processor (String)

    a stringified report processor class name

  • options (Hash)

    hash of options that will be passed to the job processor

Returns:

  • (nil)


14
15
16
17
18
19
20
21
22
# File 'lib/canvas_sync/jobs/report_processor_job.rb', line 14

def perform(report_name, report_url, processor, options, report_id)
  @job_log.update(job_class: processor)
  download(report_name, report_url) do |file_path|
    options = batch_context.merge(options).merge({
      report_processor_job_id: @job_log.job_id
    })
    processor.constantize.process(file_path, options, report_id)
  end
end