Module: Misty::Openstack::Extension

Included in:
API::Keystone::V2_0, API::Keystone::V3
Defined in:
lib/misty/openstack/extension.rb

Instance Method Summary collapse

Instance Method Details

#apiObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/misty/openstack/extension.rb', line 4

def api
  @api_fusion ||= begin
    list = super
    api_ext.each do |key, value|
      if list.include?(key)
        target = list[key]
        value.each do |verb, methods|
          if target.has_key?(verb)
            # Add methods to existing Verb
            methods.each do |method|
              raise RuntimeError, "#{key} => #{verb} already includes: #{method}" if target[verb].include?(method)
              target[verb] << method
            end
          else
            # Add Verb
            target.merge!(verb => methods)
          end
        end
      else
        # Add Resource
        list.merge!(key => value)
      end
    end
    list
  end
  @api_fusion
end