class OVIRT::Network

Attributes

cluster[R]
datacenter[R]
description[R]
mtu[R]
status[R]
stp[R]
usages[R]
vlan_id[R]

Public Class Methods

new(client, xml) click to toggle source
Calls superclass method OVIRT::BaseObject::new
  # File lib/ovirt/network.rb
5 def initialize(client, xml)
6   super(client, xml[:id], xml[:href], (xml/'name').first.text)
7   parse_xml_attributes!(xml)
8   self
9 end

Private Instance Methods

parse_xml_attributes!(xml) click to toggle source
   # File lib/ovirt/network.rb
13 def parse_xml_attributes!(xml)
14   @description = ((xml/'description').first.text rescue nil)
15   @stp = ((xml/'stp').first.text rescue false)
16   @mtu = ((xml/'mtu').first.text rescue nil)
17   @vlan_id = ((xml/'vlan').first[:id] rescue nil)
18   @usages = ((xml/'usages/usage').collect{ |usage| usage.text } rescue [])
19   @datacenter = Link::new(@client, (xml/'data_center').first[:id], (xml/'data_center').first[:href]) unless (xml/'data_center').empty?
20   @cluster = Link::new(@client, (xml/'cluster').first[:id], (xml/'cluster').first[:href]) unless (xml/'cluster').empty?
21   @status = ((xml/'status/state').first.text rescue nil)
22 end