Class: VCloudSdk::Xml::ProductSection
- Defined in:
- lib/ruby_vcloud_sdk/xml/wrapper_classes/product_section.rb
Instance Method Summary collapse
Methods inherited from Wrapper
#==, #[], #[]=, #add_child, #attribute, #content, #content=, #create_child, #create_qualified_name, #create_xpath_query, #doc_namespaces, #edit_link, #get_nodes, #href, #href=, #href_id, #initialize, #name, #name=, #power_off_link, #power_on_link, #remove_link, #running_tasks, #to_s, #type, #type=, #undeploy_link, #urn, #xpath
Constructor Details
This class inherits a constructor from VCloudSdk::Xml::Wrapper
Instance Method Details
#add_property(property) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ruby_vcloud_sdk/xml/wrapper_classes/product_section.rb', line 4 def add_property(property) property_node = add_child("Property", ovf_namespace_prefix, OVF) property_node["#{ovf_namespace_prefix}:type"] = property["type"].nil? ? "string" : property["type"] property_node["#{ovf_namespace_prefix}:key"] = property["key"] property_node["#{ovf_namespace_prefix}:value"] = property["value"] property_node["#{ovf_namespace_prefix}:password"] = property["password"] if property["password"] # default to false property_node["#{ovf_namespace_prefix}:userConfigurable"] = property["userConfigurable"] if property["userConfigurable"] # default to false %w[Label Description].each do |k| add_child_node_property(property_node, property, k) end if property["value"].nil? value_node = add_child("Value", ovf_namespace_prefix, OVF, property_node) value_node.attribute("value").value = property["value"] end end |
#properties ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ruby_vcloud_sdk/xml/wrapper_classes/product_section.rb', line 27 def properties get_nodes("Property", nil, true, OVF).map do |property_node| property = {} %w[type key value password userConfigurable].each do |k| attr = property_node.attribute(k) property[k] = attr.nil? ? "" : attr.content end %w[Label Description].each do |k| read_child_node_property(property_node, property, k) end value_node = property_node.get_nodes("Value", nil, true, OVF).first property["value"] = value_node.attribute("value").content unless value_node.nil? property end end |