2010-10-29 19:24:34 -04:00
|
|
|
module Fog
|
|
|
|
class Storage
|
|
|
|
|
|
|
|
def self.new(attributes)
|
2010-12-13 20:51:16 -05:00
|
|
|
attributes = attributes.dup # prevent delete from having side effects
|
|
|
|
case provider = attributes.delete(:provider)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'AWS'
|
2010-10-29 19:24:34 -04:00
|
|
|
require 'fog/aws'
|
|
|
|
Fog::AWS::Storage.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'Google'
|
2010-10-29 19:24:34 -04:00
|
|
|
require 'fog/google'
|
|
|
|
Fog::Google::Storage.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'Local'
|
2010-10-29 19:24:34 -04:00
|
|
|
require 'fog/local'
|
|
|
|
Fog::Local::Storage.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'Rackspace'
|
2010-10-29 19:24:34 -04:00
|
|
|
require 'fog/rackspace'
|
|
|
|
Fog::Rackspace::Storage.new(attributes)
|
|
|
|
else
|
|
|
|
raise ArgumentError.new("#{provider} is not a recognized storage provider")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-01-07 18:34:20 -05:00
|
|
|
end
|