Sha256: 04b9e738c4551ce4aee1e404f5e487d31efb41312acf58474158cc41994c74c9
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module Hydra::Works class UploadFileToFileSet # Sets a file as the primary file (original_file) of the generic_file # @param [Hydra::PCDM::FileSet] generic_file the file will be added to # @param [IO,File,Rack::Multipart::UploadedFile, #read] object that will be the contents. If file responds to :mime_type or :original_name, those will be called to provide technical metadata. # @param [Array] additional_services (ie Generating Thumbnails) to call with generic_file after adding the file as its original_file # @param [Boolean] update_existing whether to update an existing file if there is one. When set to true, performs a create_or_update. When set to false, always creates a new file within generic_file.files. # @param [Boolean] versioning whether to create new version entries (only applicable if +type+ corresponds to a versionable file) def self.call(generic_file, file, additional_services: [], update_existing: true, versioning: true) Hydra::Works::AddFileToFileSet.call(generic_file, file, :original_file, update_existing: update_existing, versioning: versioning) # Call any additional services additional_services.each do |service| service.call(generic_file) end generic_file.save generic_file end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hydra-works-0.4.0 | lib/hydra/works/services/upload_file_to_file_set.rb |
hydra-works-0.3.0 | lib/hydra/works/services/upload_file_to_file_set.rb |