From 475609602ca7e0b40a015e700231f711a40b3f55 Mon Sep 17 00:00:00 2001 From: Andrew Newman Date: Wed, 2 Nov 2011 15:00:53 +1000 Subject: [PATCH] Missing HEAD method. --- lib/fog/ninefold/models/storage/files.rb | 18 +++++++++--------- .../ninefold/requests/storage/head_object.rb | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/fog/ninefold/models/storage/files.rb b/lib/fog/ninefold/models/storage/files.rb index 8adedf997..81b34b1ca 100644 --- a/lib/fog/ninefold/models/storage/files.rb +++ b/lib/fog/ninefold/models/storage/files.rb @@ -15,14 +15,14 @@ module Fog model Fog::Storage::Ninefold::File - def all(options = { }) + def all(options = {}) requires :directory directory ? ns = directory.key : ns = '' ns = ns + '/' unless ns =~ /\/$/ data = connection.get_namespace(ns).body[:DirectoryList] - data = { :DirectoryEntry => [] } if data.kind_of? String + data = {:DirectoryEntry => []} if data.kind_of? String data[:DirectoryEntry] = [data[:DirectoryEntry]] if data[:DirectoryEntry].kind_of? Hash - files = data[:DirectoryEntry].select { |de| de[:FileType] == 'regular' } + files = data[:DirectoryEntry].select {|de| de[:FileType] == 'regular'} files.each do |s| s[:directory] = directory end @@ -32,10 +32,10 @@ module Fog def get(key, &block) requires :directory - data = connection.get_namespace(directory.key + key, :parse => false) #, &block) + data = connection.get_namespace(directory.key + key, :parse => false)#, &block) file_data = data.headers.merge({ - :body => data.body, - :key => key + :body => data.body, + :key => key }) new(file_data) rescue Fog::Storage::Ninefold::NotFound @@ -53,15 +53,15 @@ module Fog requires :directory data = connection.head_object(directory.key + key, :parse => false) file_data = data.headers.merge({ - :body => data.body, - :key => key + :body => data.body, + :key => key }) new(file_data) rescue Fog::Storage::Ninefold::NotFound nil end - def new(attributes = { }) + def new(attributes = {}) requires :directory super({ :directory => directory }.merge!(attributes)) end diff --git a/lib/fog/ninefold/requests/storage/head_object.rb b/lib/fog/ninefold/requests/storage/head_object.rb index b9333b916..07752ec57 100644 --- a/lib/fog/ninefold/requests/storage/head_object.rb +++ b/lib/fog/ninefold/requests/storage/head_object.rb @@ -2,15 +2,15 @@ module Fog module Storage class Ninefold class Real - def head_object(namespace = '', options = {}) - options = options.reject {|key, value| value.nil?} + def head_object(namespace = '', options = { }) + options = options.reject { |key, value| value.nil? } request({ :expects => 200, :method => 'HEAD', :path => "namespace/" + namespace, :query => {}, :parse => true - }.merge(options)) + }.merge(options)) end end end