Class: CanvasSync::Jobs::SyncSimpleTableJob

Inherits:
ReportStarter show all
Defined in:
lib/canvas_sync/jobs/sync_simple_table_job.rb

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(options) ⇒ Object

Starts a report processor for the specified report (the specified report must be enabled)

}

Parameters:

  • options (Hash)

    { report_name: “”, # Name of the report in the Canvas API model: , # Model to map the report results as mapping: {} # Mapping to describe how to convert the report to the Model, klass: , params: {}, # List of params to pass to the report



15
16
17
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 15

def perform(options)
  start_report(report_params(options), options)
end

#report_params(options, canvas_term_id = options[:canvas_term_id] || batch_context[:canvas_term_id]) ⇒ Object



28
29
30
31
32
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 28

def report_params(options, canvas_term_id = options[:canvas_term_id] || batch_context[:canvas_term_id])
  params = options[:params] || {}
  params["parameters[enrollment_term_id]"] = canvas_term_id if canvas_term_id
  params
end

#start_report(params, options) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 19

def start_report(params, options)
  CanvasSync::Jobs::ReportStarter.perform_later(
    options[:report_name],
    params,
    CanvasSync::Processors::NormalProcessor.to_s,
    options,
  )
end