class Canistor::Storage::Object::CopyObjectResult

Renders the result of a copy request.

Public Class Methods

new(source_object, object) click to toggle source
# File lib/canistor/storage/object.rb, line 10
def initialize(source_object, object)
  @source_object, @object = source_object, object
end
serve(context, subject, source_object, object) click to toggle source
# File lib/canistor/storage/object.rb, line 29
def self.serve(context, subject, source_object, object)
  result = new(source_object, object)
  context.http_response.signal_headers(200, result.headers)
  context.http_response.signal_data(result.to_xml)
end

Public Instance Methods

headers() click to toggle source
# File lib/canistor/storage/object.rb, line 14
def headers
  @object.identity_headers.merge(
    'x-amz-copy-source-version-id' => @source_object.version_id
  )
end
to_xml() click to toggle source
# File lib/canistor/storage/object.rb, line 20
def to_xml
  Nokogiri::XML::Builder.new do |xml|
    xml.CopyObjectResult do
      xml.LastModified @object.last_modified
      xml.ETag @object.etag
    end
  end.to_xml
end