Class: Topographer::Importer::Strategy::ImportStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/topographer/importer/strategy/import_status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_identifier) ⇒ ImportStatus

Returns a new instance of ImportStatus.



5
6
7
8
9
10
# File 'lib/topographer/importer/strategy/import_status.rb', line 5

def initialize(input_identifier)
  @input_identifier = input_identifier
  @errors = {mapping: [],
             validation: []}

end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



2
3
4
# File 'lib/topographer/importer/strategy/import_status.rb', line 2

def errors
  @errors
end

#input_identifierObject (readonly)

Returns the value of attribute input_identifier.



2
3
4
# File 'lib/topographer/importer/strategy/import_status.rb', line 2

def input_identifier
  @input_identifier
end

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/topographer/importer/strategy/import_status.rb', line 3

def message
  @message
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



2
3
4
# File 'lib/topographer/importer/strategy/import_status.rb', line 2

def timestamp
  @timestamp
end

Instance Method Details

#add_error(error_source, error) ⇒ Object



16
17
18
# File 'lib/topographer/importer/strategy/import_status.rb', line 16

def add_error(error_source, error)
  errors[error_source] << error
end

#error_countObject



20
21
22
# File 'lib/topographer/importer/strategy/import_status.rb', line 20

def error_count
  errors.values.flatten.length
end

#errors?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/topographer/importer/strategy/import_status.rb', line 24

def errors?
  errors.values.flatten.any?
end

#set_timestampObject



12
13
14
# File 'lib/topographer/importer/strategy/import_status.rb', line 12

def set_timestamp
  @timestamp ||= DateTime.now
end