2010-09-08 18:00:47 -04:00
|
|
|
require 'fog/collection'
|
2010-09-09 20:50:38 -04:00
|
|
|
require 'fog/slicehost/models/compute/flavor'
|
2010-09-08 18:00:47 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Slicehost
|
|
|
|
class Compute
|
|
|
|
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
2010-09-09 20:50:38 -04:00
|
|
|
model Fog::Slicehost::Compute::Flavor
|
2010-09-08 18:00:47 -04:00
|
|
|
|
|
|
|
def all
|
|
|
|
data = connection.get_flavors.body['flavors']
|
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(flavor_id)
|
2010-09-09 20:50:38 -04:00
|
|
|
data = connection.get_flavor(flavor_id).body
|
|
|
|
new(data)
|
2010-09-08 18:00:47 -04:00
|
|
|
rescue Excon::Errors::Forbidden
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|