class Shrine::Plugins::DownloadEndpoint::FileUrl

Attributes

file[R]

Public Class Methods

new(file) click to toggle source
# File lib/shrine/plugins/download_endpoint.rb, line 64
def initialize(file)
  @file = file
end

Public Instance Methods

call(host: self.host) click to toggle source
# File lib/shrine/plugins/download_endpoint.rb, line 68
def call(host: self.host)
  [host, *prefix, path].join("/")
end

Protected Instance Methods

host() click to toggle source
# File lib/shrine/plugins/download_endpoint.rb, line 78
def host
  options[:host]
end
options() click to toggle source
# File lib/shrine/plugins/download_endpoint.rb, line 86
def options
  file.shrine_class.opts[:download_endpoint]
end
path() click to toggle source
# File lib/shrine/plugins/download_endpoint.rb, line 74
def path
  file.urlsafe_dump(metadata: %w[filename size mime_type])
end
prefix() click to toggle source
# File lib/shrine/plugins/download_endpoint.rb, line 82
def prefix
  options[:prefix]
end