Class: Robots::SdrRepo::SdrIngest::CompleteDeposit

Inherits:
Robots::SdrRepo::SdrRobot show all
Defined in:
lib/sdr_ingest/complete_deposit.rb

Overview

Robot for completing the processing of each ingested object

Instance Method Summary collapse

Methods inherited from Robots::SdrRepo::SdrRobot

#create_workflow_rows, #get_workflow_status, #get_workflow_xml, #process_item, #transmit, #update_workflow_error_status, #update_workflow_status

Constructor Details

#initialize(opts = {}) ⇒ CompleteDeposit

set workflow name, step name, log location, log severity level


16
17
18
# File 'lib/sdr_ingest/complete_deposit.rb', line 16

def initialize(opts = {})
  super(self.class.workflow_name, self.class.step_name, opts)
end

Instance Method Details

#complete_deposit(druid, storage_object) ⇒ void


33
34
35
36
37
38
39
40
# File 'lib/sdr_ingest/complete_deposit.rb', line 33

def complete_deposit(druid, storage_object)
  new_version = storage_object.ingest_bag
  result = new_version.verify_version_storage
  if result.verified == false
    LyberCore::Log.info result.to_json(verbose=false)
    raise ItemError.new("Failed verification")
  end
end

#perform(druid) ⇒ void


23
24
25
26
27
28
# File 'lib/sdr_ingest/complete_deposit.rb', line 23

def perform(druid)
  LyberCore::Log.debug("( #{__FILE__} : #{__LINE__} ) Enter perform")
  storage_object = Moab::StorageServices.find_storage_object(druid, include_deposit=true)
  storage_object.object_pathname.mkpath
  complete_deposit(druid, storage_object)
end

#verification_files(druid) ⇒ Object


52
53
54
55
56
# File 'lib/sdr_ingest/complete_deposit.rb', line 52

def verification_files(druid)
  files = []
  files << Moab::StorageServices.object_path(druid).to_s
  files
end

#verification_queries(druid) ⇒ Object


42
43
44
45
46
47
48
49
50
# File 'lib/sdr_ingest/complete_deposit.rb', line 42

def verification_queries(druid)
  storage_url = Sdr::Config.sdr_storage_url
  workflow_url = Dor::Config.workflow.url
  queries = []
  queries << [
      "#{storage_url}/objects/#{druid}",
      200, /<html>/]
  queries
end