Class: SolidusImporter::BaseImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_importer/base_importer.rb

Direct Known Subclasses

OrderImporter

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ BaseImporter

Returns a new instance of BaseImporter.



5
6
7
# File 'lib/solidus_importer/base_importer.rb', line 5

def initialize(options)
  @options = options
end

Instance Method Details

#after_import(context) ⇒ Object

Defines a method called after the import process is finished



24
25
26
# File 'lib/solidus_importer/base_importer.rb', line 24

def after_import(context)
  context
end

#before_import(initial_context) ⇒ Object

Defines a method called before the import process is started. Remember to always return a context with ‘success` key.

  • initial_context: context used process the rows, example: ‘{ success: true }`



18
19
20
# File 'lib/solidus_importer/base_importer.rb', line 18

def before_import(initial_context)
  initial_context
end

#handle_row_import(_ending_row_context) ⇒ Object

Defines a method called after the import of each row



30
31
# File 'lib/solidus_importer/base_importer.rb', line 30

def handle_row_import(_ending_row_context)
end

#processorsObject



9
10
11
# File 'lib/solidus_importer/base_importer.rb', line 9

def processors
  @options[:processors] || []
end