Sha256: dad91fbab862021f45c1118b8a32e7fa5e6d919b717e2f88dd3cd13e8311bb0a

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 KB

Contents

module Fog
  module Parsers
    module AWS
      module Storage

        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', 'ID'
              @object['Owner'][name] = @value
            when 'ETag'
              @object[name] = @value.gsub('"', '')
            when 'IsTruncated'
              if @value == 'true'
                @response['IsTruncated'] = true
              else
                @response['IsTruncated'] = false
              end
            when 'LastModified'
              @object['LastModified'] = Time.parse(@value)
            when 'Marker', 'Name', 'Prefix'
              @response[name] = @value
            when 'MaxKeys'
              @response['MaxKeys'] = @value.to_i
            when 'Size'
              @object['Size'] = @value.to_i
            when 'Delimeter', 'Key', 'Name', 'StorageClass'
              @object[name] = @value
            end
          end

        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.3.7 lib/fog/aws/parsers/storage/get_bucket.rb
fog-0.3.6 lib/fog/aws/parsers/storage/get_bucket.rb
fog-0.3.5 lib/fog/aws/parsers/storage/get_bucket.rb
fog-0.3.4 lib/fog/aws/parsers/storage/get_bucket.rb
fog-0.3.3 lib/fog/aws/parsers/storage/get_bucket.rb
fog-0.3.2 lib/fog/aws/parsers/storage/get_bucket.rb
fog-0.3.1 lib/fog/aws/parsers/storage/get_bucket.rb
fog-0.3.0 lib/fog/aws/parsers/storage/get_bucket.rb