lib/vcloud-rest/vcloud/vm.rb
def delete_vm_network(vmId, network)
      params = {
        'method' => :get,
        'command' => "/vApp/vm-#{vmId}/networkConnectionSection"
      }

      netconfig_response, headers = send_request(params)

      picked_network = netconfig_response.css("NetworkConnection").select do |net|
        net.attribute('network').text == network[:name]
      end.first

      raise WrongItemIDError, "Network #{network[:name]} not found on this VM." unless picked_network

      picked_network.remove

      params = {
        'method' => :put,
        'command' => "/vApp/vm-#{vmId}/networkConnectionSection"
      }

      put_response, headers = send_request(params, netconfig_response.to_xml, "application/vnd.vmware.vcloud.networkConnectionSection+xml")

      task_id = headers[:location].gsub(/.*\/task\//, "")
      task_id
    end
def delete_vm_network(vmId, network)
      params = {
        'method' => :get,
        'command' => "/vApp/vm-#{vmId}/networkConnectionSection"
      }

      netconfig_response, headers = send_request(params)

      picked_network = netconfig_response.css("NetworkConnection").select do |net|
        net.attribute('network').text == network[:name]
      end.first

      raise WrongItemIDError, "Network #{network[:name]} not found on this VM." unless picked_network

      picked_network.remove

      params = {
        'method' => :put,
        'command' => "/vApp/vm-#{vmId}/networkConnectionSection"
      }

      put_response, headers = send_request(params, netconfig_response.to_xml, "application/vnd.vmware.vcloud.networkConnectionSection+xml")

      task_id = headers[:location].gsub(/.*\/task\//, "")
      task_id
    end
Remove an existing network