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/compute/parsers/voxel/voxcloud_status.rb
2011-02-23 15:38:59 -08:00

39 lines
914 B
Ruby

module Fog
module Parsers
module Voxel
module Compute
class VoxcloudStatus < Fog::Parsers::Base
def reset
@response = { :stat => nil, :devices => [] }
@device = {}
end
def start_element(name, attrs = [])
super
case name
when 'rsp'
@response[:stat] = attr_value('stat', attrs)
when 'err'
@response[:error] = attr_value('msg', attrs)
when 'device'
@device = {}
end
end
def end_element(name)
case name
when 'device'
@response[:devices] << @device
@device = {}
when 'id'
@device[:id] = @value
when 'status'
@device[:status] = @value
end
end
end
end
end
end
end