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/aws/parsers/simpledb/select.rb

42 lines
1 KiB
Ruby
Raw Normal View History

require 'fog/aws/parsers/simpledb/basic'
module Fog
module Parsers
module AWS
module SimpleDB
class Select < Fog::Parsers::AWS::SimpleDB::Basic
def reset
@item_name = @attribute_name = nil
2009-07-31 02:13:48 -04:00
@response = { 'Items' => {} }
end
def end_element(name)
case name
2009-07-31 02:13:48 -04:00
when 'BoxUsage'
response[name] = value.to_f
2009-07-31 02:13:48 -04:00
when 'Item'
@item_name = @attribute_name = nil
when 'Name'
if @item_name.nil?
@item_name = value
2009-07-31 02:13:48 -04:00
response['Items'][@item_name] = {}
else
@attribute_name = value
response['Items'][@item_name][@attribute_name] ||= []
2009-07-31 02:13:48 -04:00
end
when 'NextToken', 'RequestId'
response[name] = value
2009-07-31 02:13:48 -04:00
when 'Value'
response['Items'][@item_name][@attribute_name] << sdb_decode(value)
end
end
end
end
end
end
end