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
fog-maestrodev-1.15.0.20130927082724 lib/fog/google/parsers/storage/get_bucket.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.15.0 lib/fog/google/parsers/storage/get_bucket.rb
gapinc-fog-1.14.0 lib/fog/google/parsers/storage/get_bucket.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.14.0 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.13.0 lib/fog/google/parsers/storage/get_bucket.rb
gapinc-fog-1.12.1.2 lib/fog/google/parsers/storage/get_bucket.rb
gapinc-fog-1.12.1.1 lib/fog/google/parsers/storage/get_bucket.rb
gapinc-fog-1.12.1a lib/fog/google/parsers/storage/get_bucket.rb
gapinc-fog-1.12.1 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.12.1 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.12.0 lib/fog/google/parsers/storage/get_bucket.rb
hpfog-0.0.20 lib/fog/google/parsers/storage/get_bucket.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/google/parsers/storage/get_bucket.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/google/parsers/storage/get_bucket.rb
fog-nirvanix-1.8.2 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.11.1 lib/fog/google/parsers/storage/get_bucket.rb
fog-1.11.0 lib/fog/google/parsers/storage/get_bucket.rb
fog-nirvanix-1.8.1 lib/fog/google/parsers/storage/get_bucket.rb