Class: VMware::Connection
- Inherits:
-
Object
- Object
- VMware::Connection
- Defined in:
- lib/vmware/connection.rb
Overview
A connection encapsulates the SOAP transport to the VMware API server. It does not contain any API specific code.
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(url, username, password, debug = false) ⇒ Connection
constructor
Create a new connection to the server.
-
#method_missing(methodSymbol, *params) ⇒ Object
Catch any function call and send it over the soap connection.
Constructor Details
#initialize(url, username, password, debug = false) ⇒ Connection
Create a new connection to the server.
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/vmware/connection.rb', line 48 def initialize(url, username, password, debug = false) @url, @username, @password = url, username, password @client = VimPortType.new(url) @client.wiredump_dev = STDOUT if debug # Certificates tend to be self-signed. Just ignore them. @client.['protocol.http.ssl_config.verify_mode'] = OpenSSL::SSL::VERIFY_NONE # Prepare authentication header. headerHandler = VMware::ClientAuthHeaderHandler.new(username, password) @client.headerhandler.add(headerHandler) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methodSymbol, *params) ⇒ Object
Catch any function call and send it over the soap connection.
65 66 67 |
# File 'lib/vmware/connection.rb', line 65 def method_missing(methodSymbol, *params) @client.send(methodSymbol, *params) end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
43 44 45 |
# File 'lib/vmware/connection.rb', line 43 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
43 44 45 |
# File 'lib/vmware/connection.rb', line 43 def username @username end |