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/get_node_services.rb

35 lines
800 B
Ruby
Raw Normal View History

2010-04-16 21:31:00 -04:00
module Fog
module Parsers
module Terremark
class GetNodeServices < Fog::Parsers::Base
def reset
@node_service = {}
@response = { 'NodeServices' => [] }
end
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
when 'NodeService'
@response['NodeServices'] << @node_service
@node_service = {}
2010-04-16 21:31:00 -04:00
end
end
end
end
end
end