Class: SdrClient::Deposit::UpdateDroWithFileIdentifiers

Inherits:
Object
  • Object
show all
Defined in:
lib/sdr_client/deposit/update_dro_with_file_identifiers.rb

Overview

Updates a DRO so that the structural metadata references the uploaded file ids

Class Method Summary collapse

Class Method Details

.update(request_dro:, upload_responses:) ⇒ Object

Parameters:

  • request_dro (Cocina::Model::RequestDRO)

    for depositing

  • upload_responses (Array<Files::DirectUploadResponse>)

    the responses from uploading files



10
11
12
13
14
15
16
17
# File 'lib/sdr_client/deposit/update_dro_with_file_identifiers.rb', line 10

def self.update(request_dro:, upload_responses:)
  # Manipulating request_dro as hash since immutable
  structural = request_dro.to_h[:structural]
  return request_dro.new({}) unless structural

  signed_ids = signed_id_map(upload_responses)
  request_dro.new(structural: updated_structural(structural, signed_ids))
end