Class: CanvasSync::Processors::ProvisioningReportProcessor
- Inherits:
-
ReportProcessor
- Object
- ReportProcessor
- CanvasSync::Processors::ProvisioningReportProcessor
- Defined in:
- lib/canvas_sync/processors/provisioning_report_processor.rb
Class Method Summary collapse
-
.process(report_file_path, options, report_id) ⇒ Object
Processes a provisioning report using the bulk importer.
Instance Method Summary collapse
-
#initialize(report_file_path, options) ⇒ ProvisioningReportProcessor
constructor
rubocop:disable Metrics/AbcSize.
Methods inherited from ReportProcessor
#do_bulk_import, #mapping, #mapping_for
Constructor Details
#initialize(report_file_path, options) ⇒ ProvisioningReportProcessor
rubocop:disable Metrics/AbcSize
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/canvas_sync/processors/provisioning_report_processor.rb', line 22 def initialize(report_file_path, ) # rubocop:disable Metrics/AbcSize @options = if [:models].length == 1 run_import([:models][0], report_file_path) else unzipped_file_path = extract(report_file_path) Dir[unzipped_file_path + "/*.csv"].sort.each do |file_path| model_name = file_path.split("/").last.split(".").first run_import(model_name, file_path) end end end |
Class Method Details
.process(report_file_path, options, report_id) ⇒ Object
Processes a provisioning report using the bulk importer.
options must contain a models key. If there is only one model Canvas downloads the single report directly as a CSV. If it’s more than one model Canvas downloads a ZIP file, so we have to extract that and iterate through it for processing.
18 19 20 |
# File 'lib/canvas_sync/processors/provisioning_report_processor.rb', line 18 def self.process(report_file_path, , report_id) new(report_file_path, ) end |