Sha256: f423087a9a8296ba2a26d86642f3d6ed9b8fe12a3a290f334d034b5d6ca49cc6

Contents?: true

Size: 762 Bytes

Versions: 12

Compression:

Stored size: 762 Bytes

Contents

require "yaml"

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

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
canvas_sync-0.18.8 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.18.7 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.18.6 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.18.5 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.18.3 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.18.2 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.18.1 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.18.0.beta2 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.18.0.beta1 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.17.43 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.17.42 lib/canvas_sync/processors/report_processor.rb
canvas_sync-0.17.41 lib/canvas_sync/processors/report_processor.rb