1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/google/models/compute/flavors.rb
Romain Vrignaud a38fa44112 Fix Fog::Compute::Google::Flavor all method
* list_machine_types takes one zone as argument
2013-07-31 17:04:28 +02:00

29 lines
585 B
Ruby

require 'fog/core/collection'
require 'fog/google/models/compute/flavor'
module Fog
module Compute
class Google
class Flavors < Fog::Collection
model Fog::Compute::Google::Flavor
def all
zone = service.list_zones.body['items'].first
data = connection.list_machine_types(zone['name']).body["items"]
load(data)
end
def get(identity)
data = connection.get_machine_type(identity).body
new(data)
rescue Excon::Errors::NotFound
nil
end
end
end
end
end