update rackspace models to match new identity/collection abstraction

This commit is contained in:
Wesley Beary 2009-10-25 18:24:20 -07:00
Родитель 5aaf86defa
Коммит 93954f73ff
2 изменённых файлов: 7 добавлений и 21 удалений

Просмотреть файл

@ -4,8 +4,9 @@ module Fog
class Server < Fog::Model
identity :id
attribute :admin_pass, 'adminPass'
attribute :id
attribute :name
attribute :image_id, 'imageId'
attribute :flavor_id, 'flavorId'
@ -21,11 +22,6 @@ module Fog
true
end
def reload
new_attributes = servers.get(@id).body['server']
merge_attributes(new_attributes)
end
def save
options = { 'metadata' => @metadata, 'name' => @name, 'personality' => @personality }
options = options.reject {|key, value| value.nil?}
@ -34,16 +30,6 @@ module Fog
true
end
def servers
@servers
end
private
def servers=(new_servers)
@servers = new_servers
end
end
end

Просмотреть файл

@ -15,8 +15,8 @@ module Fog
})
for server in data['servers']
servers << Fog::Rackspace::Servers::Server.new({
:connection => connection,
:servers => servers
:collection => servers,
:connection => connection
}.merge!(server))
end
servers
@ -36,13 +36,13 @@ module Fog
def new(attributes = {})
Fog::Rackspace::Servers::Server.new({
:connection => connection,
:servers => self
:collection => self,
:connection => connection
}.merge!(attributes))
end
def reload
get(id)
all
end
end