module ActiveFedora::File::Streaming

Public Instance Methods

headers(range, key, result = {}) click to toggle source

@param range [String] from stream @param key [String] from authorization_key @return [Hash]

# File lib/active_fedora/file/streaming.rb, line 12
def headers(range, key, result = {})
  result["Range"] = range if range
  result["Authorization"] = key if key
  result
end
stream(range = nil) click to toggle source

@param range [String] the Range HTTP header @return [Stream] an object that responds to each

# File lib/active_fedora/file/streaming.rb, line 4
def stream(range = nil)
  uri = URI.parse(self.uri)
  FileBody.new(uri, headers(range, authorization_key))
end

Private Instance Methods

authorization_key() click to toggle source

@return [String] current authorization token from Ldp::Client

# File lib/active_fedora/file/streaming.rb, line 50
def authorization_key
  ldp_source.client.http.headers.fetch("Authorization", nil)
end