Class: Fog::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/storage.rb

Class Method Summary collapse

Class Method Details

.new(attributes) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/storage.rb', line 4

def self.new(attributes)
  attributes = attributes.dup # prevent delete from having side effects
  case provider = attributes[:provider] # attributes.delete(:provider)
  when 'AWS'
    require 'fog/storage/aws'
    Fog::AWS::Storage.new(attributes)
  when 'Google'
    require 'fog/storage/google'
    Fog::Google::Storage.new(attributes)
  when 'Local'
    require 'fog/storage/local'
    Fog::Local::Storage.new(attributes)
  when 'Rackspace'
    require 'fog/storage/rackspace'
    Fog::Rackspace::Storage.new(attributes)
  else
    raise ArgumentError.new("#{provider} is not a recognized storage provider")
  end
end