Routes incoming requests. It first asserts that the storage is existent and allowed. Afterwards it proceeds with the file download using streaming.
Public Instance Aliases
to_s | -> | inspect |
Public Class methods
new(options)
Writes given options to instance variables.
[show source]
# File lib/shrine/plugins/download_endpoint.rb 101 def initialize(options) 102 options.each do |name, value| 103 instance_variable_set("@#{name}", value) 104 end 105 end
Public Instance methods
call(env)
[show source]
# File lib/shrine/plugins/download_endpoint.rb 107 def call(env) 108 request = Rack::Request.new(env) 109 110 status, headers, body = catch(:halt) do 111 error!(405, "Method Not Allowed") unless request.get? 112 113 handle_request(request) 114 end 115 116 headers["Content-Length"] ||= body.map(&:bytesize).inject(0, :+).to_s 117 118 [status, headers, body] 119 end
inspect()
[show source]
# File lib/shrine/plugins/download_endpoint.rb 121 def inspect 122 "#<#{@shrine_class}::DownloadEndpoint>" 123 end