Class: RbVmomi::VIM::ReflectManagedMethodExecuter

Inherits:
Object
  • Object
show all
Defined in:
lib/rbvmomi/vim/ReflectManagedMethodExecuter.rb

Instance Method Summary collapse

Instance Method Details

#execute(moid, method, args) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rbvmomi/vim/ReflectManagedMethodExecuter.rb', line 14

def execute moid, method, args
  soap_args = args.map do |k, v|
    VIM::ReflectManagedMethodExecuterSoapArgument.new.tap do |soap_arg|
      soap_arg.name = k
      xml = Builder::XmlMarkup.new indent: 0
      _connection.obj2xml xml, k, :anyType, false, v
      soap_arg.val = xml.target!
    end
  end
  result = ExecuteSoap(moid: moid, version: 'urn:vim25/6.5',
                       method: method, argument: soap_args)
  if result
    _connection.deserializer.deserialize Nokogiri(result.response).root, nil
  else
    nil
  end
end

#fetch(moid, prop) ⇒ Object


8
9
10
11
12
# File 'lib/rbvmomi/vim/ReflectManagedMethodExecuter.rb', line 8

def fetch moid, prop
  result = FetchSoap(moid: moid, version: 'urn:vim25/6.5', prop: prop)
  xml = Nokogiri(result.response)
  _connection.deserializer.deserialize xml.root, nil
end