Module: RbVmomi
- Defined in:
- lib/rbvmomi.rb,
lib/rbvmomi/types.rb
Defined Under Namespace
Modules: VIM Classes: AnyType, Binary, Boolean, DeserializationFailed, Fault, Soap
Class Method Summary collapse
-
.connect(opts) ⇒ Object
host, port, ssl, user, password, path, debug.
- .fault(msg, fault) ⇒ Object
- .type(name) ⇒ Object
Class Method Details
.connect(opts) ⇒ Object
host, port, ssl, user, password, path, debug
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/rbvmomi.rb', line 260 def self.connect opts fail unless opts.is_a? Hash fail "host option required" unless opts[:host] opts[:user] ||= 'root' opts[:password] ||= '' opts[:ssl] = true unless opts.member? :ssl opts[:port] ||= (opts[:ssl] ? 443 : 80) opts[:path] ||= '/sdk' opts[:ns] ||= 'urn:vim25' opts[:debug] = (!ENV['RBVMOMI_DEBUG'].empty? rescue false) unless opts.member? :debug opts[:vim_debug] = (!ENV['RBVMOMI_VIM_DEBUG'].empty? rescue false) unless opts.member? :vim_debug Soap.new(opts).tap do |vim| vim.serviceContent.sessionManager.Login :userName => opts[:user], :password => opts[:password] end end |
.fault(msg, fault) ⇒ Object
255 256 257 |
# File 'lib/rbvmomi.rb', line 255 def self.fault msg, fault Fault.new(msg, fault) end |
.type(name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rbvmomi.rb', line 11 def self.type name fail unless name and (name.is_a? String or name.is_a? Symbol) name = $' if name.to_s =~ /^xsd:/ case name.to_sym when :anyType then AnyType when :boolean then Boolean when :string then String when :int, :long, :short, :byte then Integer when :float, :double then Float when :dateTime then Time when :base64Binary then Binary else if VIM.has_type? name VIM.type name else fail "no such type #{name.inspect}" end end end |