Sha256: baa77cabdeb2fc93593f95cfb17f9b23c493d8f4bed1c81fc56c0ecb0ef414d4
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require 'fog/core/collection' require 'fog/external/models/storage/file' module Fog module Storage class External class Files < Fog::Collection attribute :directory model Fog::Storage::External::File def all requires :directory load(connection.remote.list_files(directory.key)) end def get(id) requires :directory data = connection.remote.get_file(file_key(id)) if data new(data) else nil end end def head(id) # hackish! requires :directory real_key = file_key(id) if data = connection.remote.list_files(directory.key).detect{|c|c[:key] == real_key} new(data) else nil end end def new(attributes = {}) requires :directory super({ :directory => directory }.merge!(attributes)) end private def file_key(id) ::File.join(directory.key, id) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-external-0.0.1 | lib/fog/external/models/storage/files.rb |