Sha256: 34bacdc25398be0fa2c3cf11dd884f164e6d292261665ea0fa4883c9a9f19a3b
Contents?: true
Size: 813 Bytes
Versions: 3
Compression:
Stored size: 813 Bytes
Contents
module OVIRT class Template < BaseObject attr_reader :description, :status, :cluster def initialize(client, xml) super(client, xml[:id], xml[:href], (xml/'name').first.text) parse_xml_attributes!(xml) self end def self.to_xml(vm_id, opts={}) builder = Nokogiri::XML::Builder.new do template_ { name_ opts[:name] || "t-#{Time.now.to_i}" description opts[:description] || '' vm(:id => vm_id) } end Nokogiri::XML(builder.to_xml).root.to_s end private def parse_xml_attributes!(xml) @description = ((xml/'description').first.text rescue nil) @status = (xml/'status').first.text @cluster = Link::new(@client, (xml/'cluster').first[:id], (xml/'cluster').first[:href]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rbovirt-0.0.3 | lib/ovirt/template.rb |
rbovirt-0.0.2 | lib/ovirt/template.rb |
rbovirt-0.0.1 | lib/ovirt/template.rb |