Class: Fog::Parsers::Terremark::Shared::GetTasksList
- Inherits:
-
Base
- Object
- Nokogiri::XML::SAX::Document
- Base
- Fog::Parsers::Terremark::Shared::GetTasksList
show all
- Defined in:
- lib/fog/terremark/parsers/shared/get_tasks_list.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
40
41
42
43
44
45
|
# File 'lib/fog/terremark/parsers/shared/get_tasks_list.rb', line 40
def end_element(name)
if name == 'Task'
@response['Tasks'] << @task
@task = {}
end
end
|
#reset ⇒ Object
8
9
10
11
|
# File 'lib/fog/terremark/parsers/shared/get_tasks_list.rb', line 8
def reset
@response = { 'Tasks' => [] }
@task = {}
end
|
#start_element(name, attributes) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/fog/terremark/parsers/shared/get_tasks_list.rb', line 13
def start_element(name, attributes)
super
case name
when 'Owner', 'Result'
data = {}
until attributes.empty?
data[attributes.shift] = attributes.shift
end
@task[name] = data
when 'Task'
until attributes.empty?
@task[attributes.shift] = attributes.shift
end
when 'TasksList'
tasks_list = {}
until attributes.empty?
if attributes.first.is_a?(Array)
attribute = attributes.shift
tasks_list[attribute.first] = attribute.last
else
tasks_list[attributes.shift] = attributes.shift
end
end
@response['href'] = tasks_list['href']
end
end
|