Class: HttpsVmPackage

Inherits:
VmPackage show all
Defined in:
lib/ovfparse/vmpackage.rb

Constant Summary

Constants inherited from VmPackage

VmPackage::DEBUG_MODE, VmPackage::ISO, VmPackage::OVA, VmPackage::OVF, VmPackage::OVF_NAMESPACE, VmPackage::PRODUCT_ATTRIBUTES, VmPackage::PRODUCT_ELEMENTS, VmPackage::PROPERTY_ATTRIBUTES, VmPackage::PROPERTY_ELEMENTS

Instance Attribute Summary

Attributes inherited from VmPackage

#base_path, #diskSection, #name, #networkSection, #protocol, #references, #size, #state, #url, #version, #virtualSystem, #xml

Instance Method Summary collapse

Methods inherited from VmPackage

#buildNewIDEController, #checkschema, construct_skeleton, create, #getChildByName, #getChildrenByName, #getFirstOpenIDEAddress, #getOpenChannelOnIDEController, #getVirtualQuantity, #getVmAttributes, #getVmCPUs, #getVmDescription, #getVmDisks, #getVmName, #getVmNetworks, #getVmOS, #getVmOS_ID, #getVmPatchLevel, #getVmRAM, #getVmReferences, #initialize, #loadElementRefs, #method_missing, #referenced_file, #removeDisksFromVirtualHardwareSection, #removeNetworksFromVirtualHardwareSection, #setAttributes, #setElements, #setProductIcon, #setPropertyDefault, #setVirtualQuantity, #setVmAttributes, #setVmCPUs, #setVmDescription, #setVmDisks, #setVmName, #setVmNetworks, #setVmOS_ID, #setVmPatchlevel, #setVmRAM, #sign, #to_s, #uri, #writeXML, #xpath

Constructor Details

This class inherits a constructor from VmPackage

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VmPackage

Instance Method Details

#fetchObject



701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
# File 'lib/ovfparse/vmpackage.rb', line 701

def fetch 
  url = URI.parse(URI.escape(self.uri))
  http = Net::HTTP.new(url.host, url.port)
  req = Net::HTTP::Get.new(url.path)
  http.use_ssl = true
  response = http.request(req)
  open(@name, "wb") { |file|
    file.write(response.body)
  }

  @xml = Nokogiri::XML(File.open(@name)) do |config|
#      config.options = Nokogiri::XML::ParseOptions.STRICT | Nokogiri::XML::ParseOptions.NOENT
    config.strict.noent
    config.strict
  end

  File.unlink(@name)   
  loadElementRefs
end