Sha256: 24cc66f61b9ef796d73107981987880b055810544cfec2ab08040a17d8d9248b

Contents?: true

Size: 560 Bytes

Versions: 5

Compression:

Stored size: 560 Bytes

Contents

module Fog
  class Slicehost

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

    class Flavors < Fog::Collection

      model Fog::Slicehost::Flavor

      def all
        if @loaded
          clear
        end
        @loaded = true
        data = connection.get_flavors.body
        for flavor in data['flavors']
          self << new(flavor)
        end
        self
      end

      def get(flavor_id)
        connection.get_flavor(flavor_id)
      rescue Excon::Errors::Forbidden
        nil
      end

    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-0.0.47 lib/fog/slicehost/models/flavors.rb
fog-0.0.46 lib/fog/slicehost/models/flavors.rb
fog-0.0.45 lib/fog/slicehost/models/flavors.rb
fog-0.0.44 lib/fog/slicehost/models/flavors.rb
fog-0.0.43 lib/fog/slicehost/models/flavors.rb