Sha256: 586c0e90c54b49ac888bd51b80072c16c3ab450ba571b53ef5286b4e4386e585

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/planning/plan'

module Fog
  module Openstack
    class Planning
      class Plans < Fog::Collection
        model Fog::Openstack::Planning::Plan

        def all
          load(service.list_plans.body)
        end

        def find_by_uuid(plan_uuid)
          new(service.get_plan(plan_uuid).body)
        end
        alias_method :get, :find_by_uuid

        def method_missing(method_sym, *arguments, &block)
          if method_sym.to_s =~ /^find_by_(.*)$/
            self.all.find do |plan|
              plan.send($1) == arguments.first
            end
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-1.31.0 lib/fog/openstack/models/planning/plans.rb
fog-1.30.0 lib/fog/openstack/models/planning/plans.rb
fog-1.29.0 lib/fog/openstack/models/planning/plans.rb