Sha256: 4c19c94d5c10f35ebcbd5fa8443bb52e18056d6291d931a76fd679016b74dfd6

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

require "yaml"

module CanvasSync
  module Processors
    # Base report processing class
    class ReportProcessor
      def mapping
        SyncMapping::Mapping.default_mappings
      end

      def mapping_for(model, key = nil)
        model.try(:get_sync_mapping, key) || mapping[key || SyncMapping::Mapping.normalize_model_name(model)]
      end

      def do_bulk_import(report_file_path, model, options: {}, mapping_key: nil)
        m = mapping_for(model, mapping_key)
        CanvasSync::Importers::BulkImporter.import(
          report_file_path,
          m[:report_columns],
          model,
          m[:conflict_target],
          import_args: options
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
canvas_sync-0.17.23.beta2 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.17.23.beta1 lib/canvas_sync/processors/report_processor.rb