Sha256: c2a0bae2113f17aff4d1d34ad7114c6af5d5a9722b1d35f3ea343ed5c7e72107

Contents?: true

Size: 649 Bytes

Versions: 3

Compression:

Stored size: 649 Bytes

Contents

require 'fog/collection'
require 'fog/bluebox/models/flavor'

module Fog
  module Bluebox

    class Mock
      def flavors
        Fog::Bluebox::Flavors.new(:connection => self)
      end
    end

    class Real
      def flavors
        Fog::Bluebox::Flavors.new(:connection => self)
      end
    end

    class Flavors < Fog::Collection

      model Fog::Bluebox::Flavor

      def all
        data = connection.get_products.body
        load(data)
      end

      def get(product_id)
        response = connection.get_product(product_id)
        new(response.body)
      rescue Fog::Bluebox::NotFound
        nil
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-0.1.8 lib/fog/bluebox/models/flavors.rb
fog-0.1.7 lib/fog/bluebox/models/flavors.rb
fog-0.1.6 lib/fog/bluebox/models/flavors.rb