Sha256: 9f66a62d269a219b5437ef6a24115cb23f66970a5563fee427d88244a740c26b

Contents?: true

Size: 1.67 KB

Versions: 111

Compression:

Stored size: 1.67 KB

Contents

module Fog
  module Parsers
    module Storage
      module Google

        class GetBucket < Fog::Parsers::Base

          def reset
            @object = { 'Owner' => {} }
            @response = { 'Contents' => [], 'CommonPrefixes' => [] }
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'CommonPrefixes'
              @in_common_prefixes = true
            end
          end

          def end_element(name)
            case name
            when 'CommonPrefixes'
              @in_common_prefixes = false
            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'
              @response[name] = value
            when 'MaxKeys'
              @response['MaxKeys'] = value.to_i
            when 'Prefix'
              if @in_common_prefixes
                @response['CommonPrefixes'] << value
              else
                @response[name] = value
              end
            when 'Size'
              @object['Size'] = value.to_i
            when 'Delimiter', 'Key', 'StorageClass'
              @object[name] = value
            end
          end

        end

      end
    end
  end
end

Version data entries

111 entries across 111 versions & 19 rubygems

Version Path
michiels-fog-1.3.1 lib/fog/google/parsers/storage/get_bucket.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb
fog-1.3.1 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.3.0 lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb
fog-1.2.0 lib/fog/google/parsers/storage/get_bucket.rb
ktheory-fog-1.1.2 lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb
fog-1.1.2 lib/fog/google/parsers/storage/get_bucket.rb
fog_tractical-1.1.4 lib/fog/google/parsers/storage/get_bucket.rb
fog_tractical-1.1.3 lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb
fog-1.1.1 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.1.0 lib/fog/google/parsers/storage/get_bucket.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/google/parsers/storage/get_bucket.rb