Module: Rackspace

Defined in:
lib/fog/rackspace/bin.rb

Instance Method Summary collapse

Instance Method Details

#[](service) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/rackspace/bin.rb', line 9

def [](service)
  @@connections ||= Hash.new do |hash, key|
    credentials = Fog.credentials.reject do |k,v|
      ![:rackspace_api_key, :rackspace_username].include?(k)
    end
    hash[key] = case key
    when :files
      Fog::Rackspace::Files.new(credentials)
    when :servers
      Fog::Rackspace::Servers.new(credentials)
    end
  end
  @@connections[service]
end

#directoriesObject


24
25
26
# File 'lib/fog/rackspace/bin.rb', line 24

def directories
  self[:files].directories
end

#flavorsObject


28
29
30
# File 'lib/fog/rackspace/bin.rb', line 28

def flavors
  self[:servers].flavors
end

#imagesObject


32
33
34
# File 'lib/fog/rackspace/bin.rb', line 32

def images
  self[:servers].images
end

#initialized?Boolean

Returns:

  • (Boolean)

5
6
7
# File 'lib/fog/rackspace/bin.rb', line 5

def initialized?
  true
end

#serversObject


36
37
38
# File 'lib/fog/rackspace/bin.rb', line 36

def servers
  self[:servers].servers
end