Class: Ddr::Batch::IngestBatchObject

Inherits:
BatchObject
  • Object
show all
Defined in:
app/models/ddr/batch/ingest_batch_object.rb

Constant Summary

Constants inherited from BatchObject

BatchObject::EVENT_SUMMARY, BatchObject::VERIFICATION_FAIL, BatchObject::VERIFICATION_PASS

Instance Method Summary collapse

Methods inherited from BatchObject

#error_prefix, pid_from_identifier, #validate

Instance Method Details

#local_validationsObject


5
6
7
8
9
# File 'app/models/ddr/batch/ingest_batch_object.rb', line 5

def local_validations
  errors = []
  errors << "#{error_prefix} Model required for INGEST operation" unless model
  errors
end

#model_datastream_keysObject


11
12
13
# File 'app/models/ddr/batch/ingest_batch_object.rb', line 11

def model_datastream_keys
  model.constantize.new.attached_files.keys
end

#process(user, opts = {}) ⇒ Object


15
16
17
# File 'app/models/ddr/batch/ingest_batch_object.rb', line 15

def process(user, opts = {})
  ingest(user, opts) unless verified
end

#results_messageObject


19
20
21
22
23
24
25
26
# File 'app/models/ddr/batch/ingest_batch_object.rb', line 19

def results_message
  if pid
    verification_result = (verified ? "Verified" : "VERIFICATION FAILURE")
    message = "Ingested #{model} #{identifier} into #{pid}...#{verification_result}"
  else
    message = "Attempt to ingest #{model} #{identifier} FAILED"
  end
end