Class: CsvImportMagic::Failure

Inherits:
Object
  • Object
show all
Defined in:
app/services/csv_import_magic/failure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(csv_parsed, importer_id) ⇒ Failure

Returns a new instance of Failure.



5
6
7
8
9
10
11
# File 'app/services/csv_import_magic/failure.rb', line 5

def initialize(csv_parsed, importer_id)
  @importer = ::Importer.find(importer_id)
  @csv_parsed = csv_parsed
  @report = csv_parsed.report
  @rows = report.invalid_rows
  @identifier = csv_parsed.config.identifiers.first
end

Instance Attribute Details

#csv_parsedObject (readonly)

Returns the value of attribute csv_parsed.



3
4
5
# File 'app/services/csv_import_magic/failure.rb', line 3

def csv_parsed
  @csv_parsed
end

#identifierObject (readonly)

Returns the value of attribute identifier.



3
4
5
# File 'app/services/csv_import_magic/failure.rb', line 3

def identifier
  @identifier
end

#importerObject (readonly)

Returns the value of attribute importer.



3
4
5
# File 'app/services/csv_import_magic/failure.rb', line 3

def importer
  @importer
end

#reportObject (readonly)

Returns the value of attribute report.



3
4
5
# File 'app/services/csv_import_magic/failure.rb', line 3

def report
  @report
end

#rowsObject (readonly)

Returns the value of attribute rows.



3
4
5
# File 'app/services/csv_import_magic/failure.rb', line 3

def rows
  @rows
end

Instance Method Details

#generateObject



13
14
15
16
# File 'app/services/csv_import_magic/failure.rb', line 13

def generate
  set_message_to_success
  set_attachement_error
end