Method: F5::Icontrol::API#method_missing

Defined in:
lib/f5/icontrol/api.rb

#method_missing(method, args = nil, &block) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/f5/icontrol/api.rb', line 18

def method_missing(method, args = nil, &block)
  if terminal_node? && supported_method?(method)
      response_key = "#{method.to_s}_response".to_sym

      response = client.call(method) do
        if args
          message args
        end
      end

      response.to_hash[response_key][:return]

  elsif supported_path? append_path(method)
    self.class.new append_path(method), @params
  else
    raise NameError, "#{method} is not supported by #{@api_path}"
  end
end