1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/models/storage/version.rb
2015-01-02 09:42:20 -08:00

33 lines
1.1 KiB
Ruby

require 'fog/core/model'
module Fog
module Storage
class AWS
class Version < Fog::Model
identity :version, :aliases => 'VersionId'
attribute :key, :aliases => 'Key'
attribute :last_modified, :aliases => ['Last-Modified', 'LastModified']
attribute :latest, :aliases => 'IsLatest', :type => :boolean
attribute :content_length, :aliases => ['Content-Length', 'Size'], :type => :integer
attribute :delete_marker, :type => :boolean
def file
@file ||= if collection.file
collection.file.directory.files.get(key, 'versionId' => version)
else
collection.directory.files.get(key, 'versionId' => version)
end
end
def destroy
if collection.file
collection.service.delete_object(collection.file.directory.key, key, 'versionId' => version)
else
collection.service.delete_object(collection.directory.key, key, 'versionId' => version)
end
end
end
end
end
end