2010-10-04 17:02:08 -04:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 21:32:51 -04:00
|
|
|
require 'fog/bluebox/models/compute/flavor'
|
2010-09-07 19:26:01 -04:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class Bluebox
|
2010-09-07 19:26:01 -04:00
|
|
|
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::Bluebox::Flavor
|
2010-09-07 19:26:01 -04:00
|
|
|
|
|
|
|
def all
|
2012-12-22 18:29:33 -05:00
|
|
|
data = service.get_products.body
|
2010-09-07 19:26:01 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(product_id)
|
2012-12-22 18:29:33 -05:00
|
|
|
response = service.get_product(product_id)
|
2010-09-07 19:26:01 -04:00
|
|
|
new(response.body)
|
2011-06-16 19:28:54 -04:00
|
|
|
rescue Fog::Compute::Bluebox::NotFound
|
2010-09-07 19:26:01 -04:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|