Class: Etna::Clients::Magma::UpdateAttributesFromCsvWorkflowMultiModel

Inherits:
UpdateAttributesFromCsvWorkflowBase show all
Defined in:
lib/etna/clients/magma/workflows/update_attributes_from_csv_workflow.rb

Defined Under Namespace

Classes: Row

Instance Attribute Summary

Attributes inherited from UpdateAttributesFromCsvWorkflowBase

#filepath, #hole_value, #json_values, #magma_crud, #model_name, #project_name

Instance Method Summary collapse

Methods inherited from UpdateAttributesFromCsvWorkflowBase

#consolidate_attributes_to_hash, #each_revision, #find_attribute, #initialize, #magma_client, #model_exists?, #models, #update_attributes

Constructor Details

This class inherits a constructor from Etna::Clients::Magma::UpdateAttributesFromCsvWorkflowBase

Instance Method Details

#parse_input_fileObject



78
79
80
81
82
83
84
85
86
# File 'lib/etna/clients/magma/workflows/update_attributes_from_csv_workflow.rb', line 78

def parse_input_file
  CSV.parse(File.read(filepath)).map do |csv_row|
    row = Row.new(csv_row, self)

    raise "Invalid model \"#{row.model_name}\" for project #{project_name}." unless model_exists?(row.model_name)

    yield [row.model_name, row.record_name, row.to_h]
  end
end