Class: Shrine::Plugins::DownloadEndpoint::FileUrl
- Inherits:
-
Object
- Object
- Shrine::Plugins::DownloadEndpoint::FileUrl
- Defined in:
- lib/shrine/plugins/download_endpoint.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #call(host: self.host, expires_in: nil) ⇒ Object
-
#initialize(file) ⇒ FileUrl
constructor
A new instance of FileUrl.
Constructor Details
#initialize(file) ⇒ FileUrl
Returns a new instance of FileUrl.
67 68 69 |
# File 'lib/shrine/plugins/download_endpoint.rb', line 67 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
65 66 67 |
# File 'lib/shrine/plugins/download_endpoint.rb', line 65 def file @file end |
Instance Method Details
#call(host: self.host, expires_in: nil) ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/shrine/plugins/download_endpoint.rb', line 71 def call(host: self.host, expires_in: nil) path = file.urlsafe_dump(metadata: %w[filename size mime_type]) query = signature_as_query(path: path, expires_in: expires_in) path = [host, *prefix, path].join("/") path += "?#{query}" if query path end |