2010-03-17 20:51:55 -07:00
|
|
|
require 'fog/collection'
|
|
|
|
require 'fog/slicehost/models/flavor'
|
|
|
|
|
2010-02-06 15:39:14 -08:00
|
|
|
module Fog
|
2010-03-17 20:51:55 -07:00
|
|
|
module Slicehost
|
2010-02-06 15:39:14 -08:00
|
|
|
|
2010-06-12 15:31:17 -07:00
|
|
|
module Collections
|
2010-04-04 21:41:15 -07:00
|
|
|
def flavors
|
|
|
|
Fog::Slicehost::Flavors.new(:connection => self)
|
|
|
|
end
|
2010-02-06 15:39:14 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Slicehost::Flavor
|
|
|
|
|
|
|
|
def all
|
2010-03-06 20:02:10 -08:00
|
|
|
data = connection.get_flavors.body['flavors']
|
2010-04-05 15:26:27 -07:00
|
|
|
load(data)
|
2010-02-06 15:39:14 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(flavor_id)
|
|
|
|
connection.get_flavor(flavor_id)
|
|
|
|
rescue Excon::Errors::Forbidden
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|