1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Added create/update functionality.

This commit is contained in:
Sean Handley 2012-04-29 14:14:17 +01:00
parent 847712e0ae
commit a648f9d4eb

View file

@ -16,22 +16,28 @@ module Fog
attribute :encryption_cipher, :aliases => 'encryption:cipher'
def save
requires :identity
connection.update_drive(identity, attributes)
connection.update_drive(identity, allowed_attributes)
true
end
def create(attributes)
requires :name
connection.create_drive(attributes)
true
requires :size
attributes = Fog::Compute::Serverlove::Drive.new(attributes).allowed_attributes
Fog::Compute::Serverlove::Drive.new(connection.create_drive(attributes).body)
end
def destroy
requires :identity
connection.destroy_drive(identity)
true
end
end
def allowed_attributes
allowed = [:name, :size]
attributes.select {|k,v| allowed.include? k}
end
end
end
end