Class: Wings::FileMetadataBuilder Deprecated
- Inherits:
-
Object
- Object
- Wings::FileMetadataBuilder
- Includes:
- Hyrax::Noid
- Defined in:
- lib/wings/services/file_metadata_builder.rb
Overview
Deprecated.
use ‘Hyrax.storage_adapter` instead
Stores a file and an associated Hyrax::FileMetadata
Defined Under Namespace
Classes: IoDecorator
Instance Attribute Summary collapse
-
#persister ⇒ Object
readonly
Returns the value of attribute persister.
-
#storage_adapter ⇒ Object
readonly
Returns the value of attribute storage_adapter.
Instance Method Summary collapse
-
#attach_file_metadata(file_metadata:, file_set:) ⇒ Hyrax::FileMetadata
The persisted metadata file_metadata that represents the file.
-
#create(io_wrapper:, file_metadata:, file_set:) ⇒ Hyrax::FileMetadata
deprecated
Deprecated.
use ‘Hyrax.storage_adapter` instead
-
#initialize(storage_adapter:, persister:) ⇒ FileMetadataBuilder
constructor
A new instance of FileMetadataBuilder.
Methods included from Hyrax::Noid
Constructor Details
#initialize(storage_adapter:, persister:) ⇒ FileMetadataBuilder
Returns a new instance of FileMetadataBuilder.
11 12 13 14 15 |
# File 'lib/wings/services/file_metadata_builder.rb', line 11 def initialize(storage_adapter:, persister:) Deprecation.warn('This class is deprecated; use Wings::Valkyrie::Storage instead.') @storage_adapter = storage_adapter @persister = persister end |
Instance Attribute Details
#persister ⇒ Object (readonly)
Returns the value of attribute persister.
10 11 12 |
# File 'lib/wings/services/file_metadata_builder.rb', line 10 def persister @persister end |
#storage_adapter ⇒ Object (readonly)
Returns the value of attribute storage_adapter.
10 11 12 |
# File 'lib/wings/services/file_metadata_builder.rb', line 10 def storage_adapter @storage_adapter end |
Instance Method Details
#attach_file_metadata(file_metadata:, file_set:) ⇒ Hyrax::FileMetadata
Returns the persisted metadata file_metadata that represents the file.
40 41 42 |
# File 'lib/wings/services/file_metadata_builder.rb', line 40 def (file_metadata:, file_set:) file_set.is_a?(::Valkyrie::Resource) ? (, file_set) : end |
#create(io_wrapper:, file_metadata:, file_set:) ⇒ Hyrax::FileMetadata
Deprecated.
use ‘Hyrax.storage_adapter` instead
Returns the persisted metadata file_metadata that represents the file.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/wings/services/file_metadata_builder.rb', line 23 def create(io_wrapper:, file_metadata:, file_set:) Deprecation.warn('Use storage_adapter.upload, Fedora creates a `FileMetadata` (describedBy) implictly. ' \ 'Query it with Hyrax.custom_queries.find_file_metadata_by(id: stored_file.id).') io_wrapper = build_file(io_wrapper, .type) stored_file = storage_adapter.upload(file: io_wrapper, original_filename: io_wrapper.original_filename, content_type: io_wrapper.content_type, resource: file_set, use: Array(.type).first, id_hint: assign_id) Hyrax.custom_queries.(id: stored_file.id) end |