class OVIRT::Template

Attributes

cluster[R]
description[R]
status[R]

Public Class Methods

new(client, xml) click to toggle source
# File lib/ovirt/template.rb, line 5
def initialize(client, xml)
  super(client, xml[:id], xml[:href], (xml/'name').first.text)
  parse_xml_attributes!(xml)
  self
end
to_xml(opts={}) click to toggle source
# File lib/ovirt/template.rb, line 11
def self.to_xml(opts={})
  builder = Nokogiri::XML::Builder.new do
    template_ {
      name_ opts[:name] || "t-#{Time.now.to_i}"
      description opts[:description] || ''
      vm(:id => opts[:vm])
    }
  end
  Nokogiri::XML(builder.to_xml).root.to_s
end