Sha256: ce333987f2f6c6c393f1aa54ce8c68ba03eb5bfe7d3d0c9c6469de33b1595380

Contents?: true

Size: 677 Bytes

Versions: 13

Compression:

Stored size: 677 Bytes

Contents

require 'fog/core/collection'
require 'fog/cloudstack/models/compute/flavor'

module Fog
  module Compute
    class Cloudstack

      class Flavors < Fog::Collection

        model Fog::Compute::Cloudstack::Flavor

        def all
          data = connection.list_service_offerings["listserviceofferingsresponse"]["serviceoffering"] || []
          load(data)
        end

        def get(flavor_id)
          if flavor = connection.list_service_offerings('id' => flavor_id)["listserviceofferingsresponse"]["serviceoffering"].first
            new(flavor)
          end
        rescue Fog::Compute::Cloudstack::BadRequest
          nil
        end
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/cloudstack/models/compute/flavors.rb
fog-nirvanix-1.8.1 lib/fog/cloudstack/models/compute/flavors.rb
fog-parser-fix-1.6.1 lib/fog/cloudstack/models/compute/flavors.rb
fog-test-again-1.6.0 lib/fog/cloudstack/models/compute/flavors.rb
fog-parser-fix-1.6.0 lib/fog/cloudstack/models/compute/flavors.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/cloudstack/models/compute/flavors.rb
fog-sgonyea-1.8.1 lib/fog/cloudstack/models/compute/flavors.rb
fog-1.8.0 lib/fog/cloudstack/models/compute/flavors.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/cloudstack/models/compute/flavors.rb
fog-1.7.0 lib/fog/cloudstack/models/compute/flavors.rb
fog-1.6.0 lib/fog/cloudstack/models/compute/flavors.rb
fog-1.5.0 lib/fog/cloudstack/models/compute/flavors.rb
fog-1.4.0 lib/fog/cloudstack/models/compute/flavors.rb