Class: Cloudinary::CarrierWave::PreloadedCloudinaryFile

Inherits:
PreloadedFile show all
Defined in:
lib/cloudinary/carrier_wave/preloaded.rb

Constant Summary

Constants inherited from PreloadedFile

PreloadedFile::PRELOADED_CLOUDINARY_PATH

Instance Attribute Summary

Attributes inherited from PreloadedFile

#filename, #public_id, #resource_type, #signature, #type, #version

Instance Method Summary collapse

Methods inherited from PreloadedFile

#identifier, #to_s, #valid?

Constructor Details

#initialize(file_info) ⇒ PreloadedCloudinaryFile

Returns a new instance of PreloadedCloudinaryFile.



39
40
41
42
43
44
45
# File 'lib/cloudinary/carrier_wave/preloaded.rb', line 39

def initialize(file_info)
  super
  raise CloudinaryException, "Cloudinary CarrierWave integration only supports uploaded images" if resource_type != "image" || type != "upload"
  if !valid?
    raise CarrierWave::IntegrityError, I18n.translate(:"errors.messages.cloudinary_signature_error", :public_id=>public_id, :default=>"Invalid signature for #{public_id}")
  end
end

Instance Method Details

#deleteObject



47
48
49
# File 'lib/cloudinary/carrier_wave/preloaded.rb', line 47

def delete
  # Do nothing. This is a virtual file.
end

#original_filenameObject



51
52
53
# File 'lib/cloudinary/carrier_wave/preloaded.rb', line 51

def original_filename
  self.filename
end