Class: Shrine::Derivation::Url

Inherits:
Command
  • Object
show all
Defined in:
lib/shrine/plugins/derivation_endpoint.rb

Instance Attribute Summary

Attributes inherited from Command

#derivation

Instance Method Summary collapse

Methods inherited from Command

delegate, #initialize

Constructor Details

This class inherits a constructor from Shrine::Derivation::Command

Instance Method Details

#call(host: nil, prefix: nil, metadata: []) ⇒ Object



306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/shrine/plugins/derivation_endpoint.rb', line 306

def call(host: nil, prefix: nil, metadata: [], **)
  base_url = [host, *prefix].join("/")
  path = path_identifier(metadata:)

  if signer
    url = [base_url, path].join("/")
    signer.call(url, **)
  else
    signed_part = signed_url("#{path}?#{query(**)}")
    [base_url, signed_part].join("/")
  end
end