Sha256: 028eddc29a70af1eb9ad7de416654da4dfb11541f189ce8396cf73bed038caa8

Contents?: true

Size: 991 Bytes

Versions: 16

Compression:

Stored size: 991 Bytes

Contents

require 'fog/core/collection'
require 'fog/hp/models/compute_v2/flavor'

module Fog
  module Compute
    class HPV2
      class Flavors < Fog::Collection
        attribute :filters

        model Fog::Compute::HPV2::Flavor

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters = filters)
          details = filters.delete(:details)
          self.filters = filters
          non_aliased_filters = Fog::HP.convert_aliased_attributes_to_original(self.model, filters)
          if details
            data = service.list_flavors_detail(non_aliased_filters).body['flavors']
          else
            data = service.list_flavors(non_aliased_filters).body['flavors']
          end
          load(data)
        end

        def get(flavor_id)
          data = service.get_flavor_details(flavor_id).body['flavor']
          new(data)
        rescue Fog::Compute::HPV2::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/hp/models/compute_v2/flavors.rb
fog-1.26.0 lib/fog/hp/models/compute_v2/flavors.rb
fog-1.25.0 lib/fog/hp/models/compute_v2/flavors.rb
nsidc-fog-1.24.1 lib/fog/hp/models/compute_v2/flavors.rb
fog-1.24.0 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.11 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.10 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.9 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.8 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.7 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.6 lib/fog/hp/models/compute_v2/flavors.rb
fog-1.23.0 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.4 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.3 lib/fog/hp/models/compute_v2/flavors.rb
ns-fog-1.22.2 lib/fog/hp/models/compute_v2/flavors.rb
fog-1.22.1 lib/fog/hp/models/compute_v2/flavors.rb