module Shrine::Plugins::DownloadEndpoint

  1. lib/shrine/plugins/download_endpoint.rb

Documentation lives in doc/plugins/download_endpoint.md on GitHub.

Methods

Public Class

  1. configure
  2. load_dependencies

Public Class methods

configure (uploader, opts = {})
[show source]
   # File lib/shrine/plugins/download_endpoint.rb
16 def self.configure(uploader, opts = {})
17   uploader.opts[:download_endpoint_storages] = opts.fetch(:storages, uploader.opts[:download_endpoint_storages])
18   uploader.opts[:download_endpoint_prefix] = opts.fetch(:prefix, uploader.opts[:download_endpoint_prefix])
19   uploader.opts[:download_endpoint_download_options] = opts.fetch(:download_options, uploader.opts.fetch(:download_endpoint_download_options, {}))
20   uploader.opts[:download_endpoint_disposition] = opts.fetch(:disposition, uploader.opts.fetch(:download_endpoint_disposition, "inline"))
21   uploader.opts[:download_endpoint_host] = opts.fetch(:host, uploader.opts[:download_endpoint_host])
22   uploader.opts[:download_endpoint_redirect] = opts.fetch(:redirect, uploader.opts.fetch(:download_endpoint_redirect, false))
23 
24   Shrine.deprecation("The :storages download_endpoint option is deprecated, you should use UploadedFile#download_url for generating URLs to the download endpoint.") if uploader.opts[:download_endpoint_storages]
25 
26   uploader.assign_download_endpoint(App) unless uploader.const_defined?(:DownloadEndpoint)
27 end
load_dependencies (uploader, opts = {})
[show source]
   # File lib/shrine/plugins/download_endpoint.rb
11 def self.load_dependencies(uploader, opts = {})
12   uploader.plugin :rack_response
13   uploader.plugin :_urlsafe_serialization
14 end