Class: SdrClient::Deposit::Request
- Inherits:
-
Object
- Object
- SdrClient::Deposit::Request
- Defined in:
- lib/sdr_client/deposit/request.rb
Overview
This represents the metadata that we send to the server for doing a deposit
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#as_json ⇒ Object
rubocop:enable Metrics/ParameterLists.
-
#for(filename) ⇒ Hash
The metadata for the file.
-
#initialize(label: nil, view: 'dark', download: 'none', location: nil, use_and_reproduction: nil, copyright: nil, apo:, collection: nil, source_id:, catkey: nil, folio_instance_hrid: nil, embargo_release_date: nil, embargo_access: 'world', embargo_download: 'world', type: Cocina::Models::ObjectType.object, viewing_direction: nil, file_sets: [], files_metadata: {}) ⇒ Request
constructor
Additional metadata includes access, preserve, shelve, publish, md5, sha1 rubocop:disable Metrics/ParameterLists.
-
#with_file_sets(file_sets) ⇒ Request
A clone of this request with the file_sets added.
Constructor Details
#initialize(label: nil, view: 'dark', download: 'none', location: nil, use_and_reproduction: nil, copyright: nil, apo:, collection: nil, source_id:, catkey: nil, folio_instance_hrid: nil, embargo_release_date: nil, embargo_access: 'world', embargo_download: 'world', type: Cocina::Models::ObjectType.object, viewing_direction: nil, file_sets: [], files_metadata: {}) ⇒ Request
Additional metadata includes access, preserve, shelve, publish, md5, sha1 rubocop:disable Metrics/ParameterLists
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 |
# File 'lib/sdr_client/deposit/request.rb', line 15 def initialize(label: nil, view: 'dark', download: 'none', location: nil, use_and_reproduction: nil, copyright: nil, apo:, collection: nil, source_id:, catkey: nil, folio_instance_hrid: nil, embargo_release_date: nil, embargo_access: 'world', embargo_download: 'world', type: Cocina::Models::ObjectType.object, viewing_direction: nil, file_sets: [], files_metadata: {}) @label = label @type = type @source_id = source_id @collection = collection @catkey = catkey @folio_instance_hrid = folio_instance_hrid @embargo_release_date = @embargo_access = @embargo_download = @view = view @download = download @location = location @use_and_reproduction = use_and_reproduction @copyright = copyright @apo = apo @file_sets = file_sets @files_metadata = @viewing_direction = viewing_direction end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
98 99 100 |
# File 'lib/sdr_client/deposit/request.rb', line 98 def type @type end |
Instance Method Details
#as_json ⇒ Object
rubocop:enable Metrics/ParameterLists
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/sdr_client/deposit/request.rb', line 54 def as_json { access: access_struct, type: type, administrative: administrative, identification: identification, structural: structural, version: 1, label: label.nil? ? ':auto' : label } end |
#for(filename) ⇒ Hash
Returns the metadata for the file.
90 91 92 93 94 95 96 |
# File 'lib/sdr_client/deposit/request.rb', line 90 def for(filename) = .fetch(filename, {}).with_indifferent_access [:view] = view unless .key?(:view) [:download] = download unless .key?(:download) [:location] = location unless .key?(:location) end |
#with_file_sets(file_sets) ⇒ Request
Returns a clone of this request with the file_sets added.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/sdr_client/deposit/request.rb', line 67 def with_file_sets(file_sets) Request.new(label: label, view: view, download: download, location: location, apo: apo, collection: collection, copyright: copyright, source_id: source_id, catkey: catkey, folio_instance_hrid: folio_instance_hrid, embargo_release_date: , embargo_access: , embargo_download: , type: type, use_and_reproduction: use_and_reproduction, viewing_direction: viewing_direction, file_sets: file_sets, files_metadata: ) end |