class BPL::Derivatives::PersistOutputFileService

Public Class Methods

call(__object_or_file_path, _directives) click to toggle source

Persists the file within the object at destination_name. Uses basic containment. If you want to use direct containment (ie. with PCDM) you must use a different service (ie. Hydra::Works::AddFileToGenericFile Service) @param [String] file_path the path to the file to be added @param [Hash] directives directions which can be used to determine where to persist to. @option directives [String] url This can determine the path of the object.

# File lib/bpl/derivatives/services/persist_output_file_service.rb, line 8
def self.call(__object_or_file_path, _directives)
  raise NotImplementedError, "PersistOutputFileService is an abstract class. Implement `call' on #{self.class.name}"
end

Private Class Methods

mime_format(extension) click to toggle source
# File lib/bpl/derivatives/services/persist_output_file_service.rb, line 12
def self.mime_format(extension)
  case extension
  when 'mp4'
    'video/mp4' # default is application/mp4
  when 'webm'
    'video/webm' # default is audio/webm
  else
    MIME::Types.type_for(extension).first.to_s
  end
end