Module: SdrClient::Deposit

Defined in:
lib/sdr_client/deposit.rb,
lib/sdr_client/deposit/file.rb,
lib/sdr_client/deposit/process.rb,
lib/sdr_client/deposit/request.rb,
lib/sdr_client/deposit/file_set.rb,
lib/sdr_client/deposit/upload_files.rb,
lib/sdr_client/deposit/model_process.rb,
lib/sdr_client/deposit/create_resource.rb,
lib/sdr_client/deposit/update_resource.rb,
lib/sdr_client/deposit/metadata_builder.rb,
lib/sdr_client/deposit/unexpected_response.rb,
lib/sdr_client/deposit/file_metadata_builder.rb,
lib/sdr_client/deposit/files/direct_upload_request.rb,
lib/sdr_client/deposit/files/direct_upload_response.rb,
lib/sdr_client/deposit/single_file_grouping_strategy.rb,
lib/sdr_client/deposit/upload_files_metadata_builder.rb,
lib/sdr_client/deposit/matching_file_grouping_strategy.rb,
lib/sdr_client/deposit/update_dro_with_file_identifiers.rb,
lib/sdr_client/deposit/file_metadata_builder_operations/md5.rb,
lib/sdr_client/deposit/file_metadata_builder_operations/sha1.rb,
lib/sdr_client/deposit/file_metadata_builder_operations/mime_type.rb

Overview

The namespace for the “deposit” command

Defined Under Namespace

Modules: FileMetadataBuilderOperations, Files Classes: CreateResource, File, FileMetadataBuilder, FileSet, MatchingFileGroupingStrategy, MetadataBuilder, ModelProcess, Process, Request, SingleFileGroupingStrategy, UnexpectedResponse, UpdateDroWithFileIdentifiers, UpdateResource, UploadFiles, UploadFilesMetadataBuilder

Constant Summary collapse

BOOK_TYPE =
'http://cocina.sul.stanford.edu/models/book.jsonld'

Class Method Summary collapse

Class Method Details

.model_run(request_dro:, files: [], url:, accession:, logger: Logger.new(STDOUT)) ⇒ Object

Parameters:

  • files (Array<String>) (defaults to: [])

    absolute paths to files



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/sdr_client/deposit.rb', line 58

def self.model_run(request_dro:,
                   files: [],
                   url:,
                   accession:,
                   logger: Logger.new(STDOUT))
  connection = Connection.new(url: url)
  ModelProcess.new(request_dro: request_dro,
                   connection: connection,
                   files: files,
                   logger: logger,
                   accession: accession).run
end

.run(label: nil, type: BOOK_TYPE, viewing_direction: nil, access: 'dark', download: 'none', use_statement: nil, copyright: nil, apo:, collection: nil, catkey: nil, embargo_release_date: nil, embargo_access: 'world', embargo_download: 'world', source_id:, url:, files: [], files_metadata: {}, accession: false, grouping_strategy: SingleFileGroupingStrategy, logger: Logger.new(STDOUT)) ⇒ String

rubocop:disable Metrics/ParameterLists rubocop:disable Metrics/MethodLength

Returns:

  • (String)

    job id for the background job result



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/sdr_client/deposit.rb', line 12

def self.run(label: nil,
             type: BOOK_TYPE,
             viewing_direction: nil,
             access: 'dark',
             download: 'none',
             use_statement: nil,
             copyright: nil,
             apo:,
             collection: nil,
             catkey: nil,
             embargo_release_date: nil,
             embargo_access: 'world',
             embargo_download: 'world',
             source_id:,
             url:,
             files: [],
             files_metadata: {},
             accession: false,
             grouping_strategy: SingleFileGroupingStrategy,
             logger: Logger.new(STDOUT))
   = FileMetadataBuilder.build(files: files, files_metadata: )
   = Request.new(label: label,
                         type: type,
                         access: access,
                         download: download,
                         apo: apo,
                         use_statement: use_statement,
                         copyright: copyright,
                         collection: collection,
                         source_id: source_id,
                         catkey: catkey,
                         embargo_release_date: embargo_release_date,
                         embargo_access: embargo_access,
                         embargo_download: embargo_download,
                         viewing_direction: viewing_direction,
                         files_metadata: )
  connection = Connection.new(url: url)
  Process.new(metadata: , connection: connection, files: files,
              grouping_strategy: grouping_strategy,
              accession: accession,
              logger: logger).run
end