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-maestrodev-1.20.0.20140305101839 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.20.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-1.19.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb