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/voxel/parsers/compute/voxcloud_create.rb

41 lines
866 B
Ruby
Raw Normal View History

2011-02-20 22:01:28 -05:00
module Fog
module Parsers
module Compute
module Voxel
2011-02-20 22:01:28 -05:00
class VoxcloudCreate < Fog::Parsers::Base
def reset
2011-02-23 18:00:56 -05:00
@response = { 'device' => {} }
2011-02-20 22:01:28 -05:00
end
def start_element(name, attrs = [])
super
case name
2011-02-23 18:00:56 -05:00
when 'err'
@response['err'] = {
'code' => attr_value('code', attrs),
'msg' => attr_value('msg', attrs)
}
2011-02-20 22:01:28 -05:00
when 'rsp'
2011-02-23 18:00:56 -05:00
@response['stat'] = attr_value('stat', attrs)
2011-02-20 22:01:28 -05:00
end
end
def end_element(name)
case name
when 'id'
@response['device'][name] = value
2011-02-23 18:00:56 -05:00
when 'last_update'
@response['device'][name] = Time.at(value.to_i)
2011-02-20 22:01:28 -05:00
end
end
end
end
end
end
end