1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/terremark/parsers/shared/get_node_services.rb

37 lines
850 B
Ruby
Raw Normal View History

2010-04-16 21:31:00 -04:00
module Fog
module Parsers
module Terremark
module Shared
2010-04-16 21:31:00 -04:00
class GetNodeServices < Fog::Parsers::Base
2010-04-16 21:31:00 -04:00
def reset
@node_service = {}
@response = { 'NodeServices' => [] }
end
2010-04-16 21:31:00 -04:00
def end_element(name)
case name
when 'Description', 'Href', 'Name', 'IpAddress'
@node_service[name] = @value
when 'Enabled'
if @value == 'true'
@node_service[name] = true
else
@node_service[name] = false
end
when 'Id', 'Port'
@node_service[name] = @value.to_i
2010-05-10 17:16:53 -04:00
when 'NodeService'
@response['NodeServices'] << @node_service
@node_service = {}
end
2010-04-16 21:31:00 -04:00
end
2010-04-16 21:31:00 -04:00
end
end
end
end
end