Class: RbVmomi::BasicTypes::ManagedObject

Inherits:
ObjectWithMethods show all
Includes:
ObjectWithRefAndConnection
Defined in:
lib/rbvmomi/basic_types.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ObjectWithRefAndConnection

#==, #_connection, #_ref, #hash, #initialize, #pretty_print, #to_hash, #to_s

Methods inherited from ObjectWithMethods

full_methods_desc, init

Methods inherited from ObjectWithProperties

find_prop_desc, full_props_desc, full_props_set, init

Methods inherited from Base

init, to_s

Class Method Details

.kindObject



229
# File 'lib/rbvmomi/basic_types.rb', line 229

def self.kind; :managed end

Instance Method Details

#[](k) ⇒ Object



259
260
261
# File 'lib/rbvmomi/basic_types.rb', line 259

def [] k
  _get_property k
end

#_call(method, o = {}) ⇒ Object



252
253
254
255
256
257
# File 'lib/rbvmomi/basic_types.rb', line 252

def _call method, o={}
  raise 'parameters must be passed as a hash' unless o.is_a? Hash

  desc = self.class.full_methods_desc[method.to_s] or raise 'unknown method'
  @connection.call method, desc, self, o
end

#_get_property(sym) ⇒ Object



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/rbvmomi/basic_types.rb', line 231

def _get_property sym
  ret = @connection.propertyCollector.RetrieveProperties(specSet: [{
    propSet: [{ type: self.class.wsdl_name, pathSet: [sym.to_s] }],
    objectSet: [{ obj: self }],
  }])[0]

  if !ret
    return nil
  elsif ret.propSet.empty?
    return nil if ret.missingSet.empty?

    raise ret.missingSet[0].fault
  else
    ret.propSet[0].val
  end
end

#_set_property(sym, val) ⇒ Object



248
249
250
# File 'lib/rbvmomi/basic_types.rb', line 248

def _set_property sym, val
  raise 'unimplemented'
end