Sha256: 6084dc5cb208bdeadbf8e46e905493b72bbb04070b4cbbfad6edb3ca2fe225d2

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'rackspace-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.connection.delete_object(collection.file.directory.key, key, 'versionId' => version)
          else
            collection.connection.delete_object(collection.directory.key, key, 'versionId' => version)
          end
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rackspace-fog-1.4.2 lib/rackspace-fog/aws/models/storage/version.rb