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/s3/get_bucket.rb

55 lines
1.4 KiB
Ruby
Raw Normal View History

module Fog
module Parsers
module AWS
module S3
class GetBucket < Fog::Parsers::Base
def reset
@object = { :owner => {} }
@response = { :contents => [] }
end
def end_element(name)
case name
when 'Contents'
@response[:contents] << @object
@object = { :owner => {} }
when 'DisplayName'
@object[:owner][:display_name] = @value
when 'ETag'
@object[:etag] = @value
when 'ID'
@object[:owner][:id] = @value
when 'IsTruncated'
if @value == 'true'
@response[:is_truncated] = true
else
@response[:is_truncated] = false
end
when 'Key'
@object[:key] = @value
when 'LastModified'
@object[:last_modified] = Time.parse(@value)
when 'Marker'
@response[:marker] = @value
when 'MaxKeys'
@response[:max_keys] = @value.to_i
when 'Name'
@response[:name] = @value
when 'Prefix'
@response[:prefix] = @value
when 'Size'
@object[:size] = @value.to_i
when 'StorageClass'
@object[:storage_class] = @value
end
end
end
end
end
end
end