Sha256: 6e3857e050105558b82edc1201f3094bbb18c52b939011665c9fa8b667cac5cd

Contents?: true

Size: 836 Bytes

Versions: 8

Compression:

Stored size: 836 Bytes

Contents

module Fog
  module Rackspace
    class Servers

      def flavors
        Fog::Rackspace::Servers::Flavors.new(:connection => self)
      end

      class Flavors < Fog::Collection

        model Fog::Rackspace::Servers::Flavor

        def all
          data = connection.list_flavors_detail.body
          flavors = Fog::Rackspace::Servers::Flavors.new({
            :connection => connection
          })
          for flavor in data['flavors']
            flavors << Fog::Rackspace::Servers::Flavor.new({
              :collection => flavors,
              :connection => connection
            }.merge!(flavor))
          end
          flavors
        end

        def get(flavor_id)
          connection.get_flavor_details(flavor_id)
        rescue Excon::Errors::NotFound
          nil
        end

      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.0.38 lib/fog/rackspace/models/servers/flavors.rb
fog-0.0.37 lib/fog/rackspace/models/servers/flavors.rb
fog-0.0.36 lib/fog/rackspace/models/servers/flavors.rb
fog-0.0.35 lib/fog/rackspace/models/servers/flavors.rb
fog-0.0.34 lib/fog/rackspace/models/servers/flavors.rb
fog-0.0.33 lib/fog/rackspace/models/servers/flavors.rb
fog-0.0.32 lib/fog/rackspace/models/servers/flavors.rb
fog-0.0.31 lib/fog/rackspace/models/servers/flavors.rb