Module: Shrine::Plugins::KitheAcceptRemoteUrl::FileMethods

Defined in:
lib/shrine/plugins/kithe_accept_remote_url.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#url_fetch_headersObject (readonly)

Returns the value of attribute url_fetch_headers.



50
51
52
# File 'lib/shrine/plugins/kithe_accept_remote_url.rb', line 50

def url_fetch_headers
  @url_fetch_headers
end

Instance Method Details

#initialize(data) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/shrine/plugins/kithe_accept_remote_url.rb', line 51

def initialize(data)
  # passed in as headers top-level key, but any but whitelisted keys actually
  # end up being thrown out by shrine, and too hard to change that, so
  # we'll copy it to 'metadata'
  if data["storage"].to_s == STORAGE_KEY.to_s && data["headers"]
    data["metadata"] ||= {}
    data["metadata"][METADATA_KEY] = data["headers"]
  end
  super
end