Class: SolidusImporter::Import
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- SolidusImporter::Import
- Defined in:
- app/models/solidus_importer/import.rb
Instance Attribute Summary collapse
-
#importer ⇒ Object
Returns the value of attribute importer.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#importer ⇒ Object
Returns the value of attribute importer.
7 8 9 |
# File 'app/models/solidus_importer/import.rb', line 7 def importer @importer end |
Class Method Details
.available_types ⇒ Object
43 44 45 |
# File 'app/models/solidus_importer/import.rb', line 43 def available_types SolidusImporter::Import.select(:import_type).order(:import_type).group(:import_type).pluck(:import_type) end |
Instance Method Details
#created_or_failed? ⇒ Boolean
28 29 30 |
# File 'app/models/solidus_importer/import.rb', line 28 def created_or_failed? %w[created failed].include? state end |
#finished? ⇒ Boolean
32 33 34 |
# File 'app/models/solidus_importer/import.rb', line 32 def finished? rows.failed_or_completed.size == rows.size end |
#import_file=(path) ⇒ Object
36 37 38 39 40 |
# File 'app/models/solidus_importer/import.rb', line 36 def import_file=(path) raise SolidusImporter::Exception, 'Existing file required' if !path || !File.exist?(path) self.file = File.open(path, 'r') end |