Class: SdrClient::RedesignedClient::File
- Inherits:
-
Object
- Object
- SdrClient::RedesignedClient::File
- Defined in:
- lib/sdr_client/redesigned_client/file.rb
Overview
This represents the File metadata that we send to the server for doing a deposit
Instance Method Summary collapse
-
#initialize(external_identifier:, label:, filename:, **options) ⇒ File
constructor
A new instance of File.
-
#to_h ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/AbcSize.
Constructor Details
#initialize(external_identifier:, label:, filename:, **options) ⇒ File
Returns a new instance of File.
21 22 23 24 25 26 |
# File 'lib/sdr_client/redesigned_client/file.rb', line 21 def initialize(external_identifier:, label:, filename:, **) @external_identifier = external_identifier @label = label @filename = filename @options = end |
Instance Method Details
#to_h ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/AbcSize
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sdr_client/redesigned_client/file.rb', line 28 def to_h # rubocop:disable Metrics/MethodLength, Metrics/AbcSize { type: Cocina::Models::ObjectType.file, label: label, filename: filename, externalIdentifier: external_identifier, access: { view: view, download: download }, administrative: { sdrPreserve: preserve, shelve: shelve, publish: publish }, version: 1, hasMessageDigests: }.tap do |json| json['hasMimeType'] = mime_type if mime_type json['use'] = use if use json[:access]['location'] if location end end |