Class: Fog::Openstack::Planning::Plans

Inherits:
Fog::OpenStack::Collection show all
Defined in:
lib/fog/planning/openstack/models/plans.rb

Instance Attribute Summary

Attributes inherited from Fog::OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from Fog::OpenStack::Collection

#destroy, #find_by_id, #load_response, #summary

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object


19
20
21
22
23
24
25
26
27
# File 'lib/fog/planning/openstack/models/plans.rb', line 19

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

Instance Method Details

#all(options = {}) ⇒ Object


10
11
12
# File 'lib/fog/planning/openstack/models/plans.rb', line 10

def all(options = {})
  load_response(service.list_plans(options))
end

#find_by_uuid(plan_uuid) ⇒ Object Also known as: get


14
15
16
# File 'lib/fog/planning/openstack/models/plans.rb', line 14

def find_by_uuid(plan_uuid)
  new(service.get_plan(plan_uuid).body)
end