зеркало из https://github.com/microsoft/fog.git
[rackspace] simplify servers mock/real with shared module
This commit is contained in:
Родитель
4857434c89
Коммит
61712013ab
|
@ -5,13 +5,7 @@ module Fog
|
|||
module Rackspace
|
||||
module Servers
|
||||
|
||||
class Real
|
||||
def flavors
|
||||
Fog::Rackspace::Servers::Flavors.new(:connection => self)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
module Collections
|
||||
def flavors
|
||||
Fog::Rackspace::Servers::Flavors.new(:connection => self)
|
||||
end
|
||||
|
|
|
@ -5,15 +5,7 @@ module Fog
|
|||
module Rackspace
|
||||
module Servers
|
||||
|
||||
class Real
|
||||
def images(attributes = {})
|
||||
Fog::Rackspace::Servers::Images.new({
|
||||
:connection => self
|
||||
}.merge!(attributes))
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
module Collections
|
||||
def images(attributes = {})
|
||||
Fog::Rackspace::Servers::Images.new({
|
||||
:connection => self
|
||||
|
|
|
@ -5,13 +5,7 @@ module Fog
|
|||
module Rackspace
|
||||
module Servers
|
||||
|
||||
class Mock
|
||||
def servers
|
||||
Fog::Rackspace::Servers::Servers.new(:connection => self)
|
||||
end
|
||||
end
|
||||
|
||||
class Real
|
||||
module Collections
|
||||
def servers
|
||||
Fog::Rackspace::Servers::Servers.new(:connection => self)
|
||||
end
|
||||
|
|
|
@ -5,6 +5,8 @@ module Fog
|
|||
class Error < Fog::Errors::Error; end
|
||||
class NotFound < Fog::Errors::NotFound; end
|
||||
|
||||
module Collections; end
|
||||
|
||||
def self.new(options={})
|
||||
|
||||
unless @required
|
||||
|
@ -47,6 +49,7 @@ module Fog
|
|||
end
|
||||
|
||||
class Mock
|
||||
include Collections
|
||||
|
||||
def self.data
|
||||
@data ||= Hash.new do |hash, key|
|
||||
|
@ -75,6 +78,7 @@ module Fog
|
|||
end
|
||||
|
||||
class Real
|
||||
include Collections
|
||||
|
||||
def initialize(options={})
|
||||
credentials = Fog::Rackspace.authenticate(options)
|
||||
|
|
Загрузка…
Ссылка в новой задаче