Sha256: a3ecfb2fd48da04df13d9a16769bf817e179bfd9ebfacb67c633038df87a0f3c

Contents?: true

Size: 1.72 KB

Versions: 60

Compression:

Stored size: 1.72 KB

Contents

module Fog
  module Parsers
    module Storage
      module AWS

        class GetBucketLifecycle < Fog::Parsers::Base

          def reset
            @expiration = {}
            @transition = {}
            @rule = {}
            @response = { 'Rules' => [] }
          end

          def start_element(name, attrs=[])
            super
            case name
            when 'Expiration'
              @in_expiration = true
            when 'Transition'
              @in_transition = true
            end
          end

          def end_element(name)
            if @in_expiration
              case name
              when 'Days'
                @expiration[name] = value.to_i
              when 'Date'
                @expiration[name] = value
              when 'Expiration'
                @rule['Expiration'] = @expiration
                @in_expiration = false
                @expiration = {}
              end
            elsif @in_transition
              case name
              when 'StorageClass', 
                @transition['StorageClass'] = value
              when 'Date'
                @transition[name] = value
              when 'Days'
                @transition[name] = value.to_i
              when 'Transition'
                @rule['Transition'] = @transition
                @in_transition = false
                @transition = {}
              end
            else
              case name
              when 'ID', 'Prefix'
                @rule[name] = value
              when 'Status'
                @rule['Enabled'] = value == 'Enabled'
              when 'Rule'
                @response['Rules'] << @rule
                @rule = {}
              end 
            end
          end
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 6 rubygems

Version Path
fog-1.15.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
gapinc-fog-1.14.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.14.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.13.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
gapinc-fog-1.12.1.2 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
gapinc-fog-1.12.1.1 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
gapinc-fog-1.12.1a lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
gapinc-fog-1.12.1 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.12.1 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.12.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
hpfog-0.0.20 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.11.1 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.11.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.10.1 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-test-me-1.10.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.10.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.9.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb