Class: Fog::Parsers::TerremarkEcloud::Compute::GetNetwork
- Inherits:
-
Base
- Object
- Nokogiri::XML::SAX::Document
- Base
- Fog::Parsers::TerremarkEcloud::Compute::GetNetwork
show all
- Defined in:
- lib/fog/compute/parsers/terremark_ecloud/get_network.rb
Instance Attribute Summary
Attributes inherited from Base
#response
Instance Method Summary
collapse
Methods inherited from Base
#attr_value, #characters, #initialize
Instance Method Details
#end_element(name) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/fog/compute/parsers/terremark_ecloud/get_network.rb', line 39
def end_element(name)
case name
when 'Configuration'
@in_configuration = false
when 'Gateway', 'Netmask'
if @in_configuration
@response['Configuration'][name] = @value
end
when 'Features'
@in_features = false
else
if @in_features
@response['Features'][name] = @value
end
end
end
|
#reset ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/fog/compute/parsers/terremark_ecloud/get_network.rb', line 8
def reset
@response = {
'Configuration' => {},
'Features' => {},
'Link' => {}
}
end
|
#start_element(name, attrs = []) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/fog/compute/parsers/terremark_ecloud/get_network.rb', line 16
def start_element(name, attrs = [])
case name
when 'Network'
for attribute in %w{href name}
if value = attr_value(attribute, attrs)
@response[attribute] = value
end
end
when 'Link'
for attribute in %w{href name rel type}
if value = attr_value(attribute, attrs)
@response[name][attribute] = value
end
end
when 'Configuration'
@in_configuration = true
when 'Features'
@in_features = true
end
super
end
|