Module: Shrine::Plugins::DownloadEndpoint::FileMethods

Defined in:
lib/shrine/plugins/download_endpoint.rb

Instance Method Summary collapse

Instance Method Details

#download_url(**options) ⇒ Object

Returns file URL on the download endpoint.



68
69
70
# File 'lib/shrine/plugins/download_endpoint.rb', line 68

def download_url(**options)
  FileUrl.new(self).call(**options)
end

#url(**options) ⇒ Object

Constructs the URL from the optional host, prefix, storage key and uploaded file’s id. For other uploaded files that aren’t in the list of storages it just returns their original URL.



58
59
60
61
62
63
64
65
# File 'lib/shrine/plugins/download_endpoint.rb', line 58

def url(**options)
  if download_storages && download_storages.include?(storage_key.to_sym)
    Shrine.deprecation("The :storages option for download_endpoint plugin is deprecated and will be obsolete in Shrine 3. Use UploadedFile#download_url instead.")
    download_url
  else
    super
  end
end