diff --git a/lib/fog/rackspace/models/storage/directories.rb b/lib/fog/rackspace/models/storage/directories.rb index 4aaf1115e..3bf37bb6c 100644 --- a/lib/fog/rackspace/models/storage/directories.rb +++ b/lib/fog/rackspace/models/storage/directories.rb @@ -15,11 +15,16 @@ module Fog end def get(key, options = {}) - data = connection.get_container(key, options).body + data = connection.get_container(key, options) directory = new(:key => key) + for key, value in data.headers + if ['X-Container-Bytes-Used', 'X-Container-Object-Count'].include?(key) + directory.merge_attributes(key => value) + end + end directory.files.merge_attributes(options) directory.files.instance_variable_set(:@loaded, true) - data.each do |file| + data.body.each do |file| directory.files << directory.files.new(file) end directory diff --git a/lib/fog/rackspace/models/storage/directory.rb b/lib/fog/rackspace/models/storage/directory.rb index 57164196a..b9061bceb 100644 --- a/lib/fog/rackspace/models/storage/directory.rb +++ b/lib/fog/rackspace/models/storage/directory.rb @@ -12,8 +12,8 @@ module Fog identity :key, :aliases => 'name' - attribute :bytes - attribute :count + attribute :bytes, :aliases => 'X-Container-Bytes-Used' + attribute :count, :aliases => 'X-Container-Object-Count' def destroy requires :key diff --git a/lib/fog/rackspace/models/storage/file.rb b/lib/fog/rackspace/models/storage/file.rb index 525bf0dd1..c2fee41f9 100644 --- a/lib/fog/rackspace/models/storage/file.rb +++ b/lib/fog/rackspace/models/storage/file.rb @@ -6,13 +6,13 @@ module Fog class File < Fog::Model - identity :key, :aliases => 'Key' + identity :key, :aliases => 'name' attr_writer :body - attribute :content_length, :aliases => 'Content-Length' - attribute :content_type, :aliases => 'Content-Type' - attribute :etag, :aliases => 'Etag' - attribute :last_modified, :aliases => 'Last-Modified' + attribute :content_length, :aliases => ['bytes', 'Content-Length'] + attribute :content_type, :aliases => ['content_type', 'Content-Type'] + attribute :etag, :aliases => ['hash', 'Etag'] + attribute :last_modified, :aliases => ['last_modified', 'Last-Modified'] def body @body ||= if last_modified