Class: Fog::Parsers::Compute::Voxel::ImagesList
- Inherits:
-
Base
- Object
- Nokogiri::XML::SAX::Document
- Base
- Fog::Parsers::Compute::Voxel::ImagesList
show all
- Defined in:
- lib/rackspace-fog/voxel/parsers/compute/images_list.rb
Instance Attribute Summary
Attributes inherited from Base
#response
Instance Method Summary
collapse
Methods inherited from Base
#attr_value, #characters, #initialize, #value
Instance Method Details
#end_element(name) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/rackspace-fog/voxel/parsers/compute/images_list.rb', line 36
def end_element(name)
case name
when 'architecture'
@image['operating_system'][name] = value.to_i
when 'admin_username', 'family', 'product_family', 'product_version', 'version'
@image['operating_system'][name] = value
when 'description'
@image[name] = value
when 'image'
@response['images'] << @image
@image = {}
when 'size'
@image['filesystem'][name] = value.to_i
when 'type'
@image['filesystem'][name] = value
end
end
|
#reset ⇒ Object
8
9
10
11
|
# File 'lib/rackspace-fog/voxel/parsers/compute/images_list.rb', line 8
def reset
@image = {}
@response = { 'images' => [] }
end
|
#start_element(name, attrs = []) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/rackspace-fog/voxel/parsers/compute/images_list.rb', line 13
def start_element(name, attrs = [])
super
case name
when 'err'
@response['err'] = {
'code' => attr_value('code', attrs),
'msg' => attr_value('msg', attrs)
}
when 'size'
@image['filesystem']['units'] = attr_value('units', attrs)
when 'image'
@image = {
'id' => attr_value('id', attrs).to_i,
'summary' => attr_value('summary', attrs)
}
when 'filesystem', 'operating_system'
@image[name] = {}
when 'rsp'
@response['stat'] = attr_value('stat', attrs)
end
end
|