Sha256: 9c8c5e4cceafea01531442f2874209d8e9beb8c2c543d34eac5b59e150d85ae1

Contents?: true

Size: 1.63 KB

Versions: 45

Compression:

Stored size: 1.63 KB

Contents

module Fog
  module Parsers
    module Storage
      module AWS
        class GetBucketNotification < Fog::Parsers::Base
          def reset
            @func = {}
            @queue = {}
            @topic = {}
            @response = {
              'Topics' => [],
              'Queues' => [],
              'CloudFunctions' => []
            }
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'TopicConfiguration'
              @configuration = 'topic'
            when 'QueueConfiguration'
              @configuration = 'queue'
            when 'CloudFunctionConfiguration'
              @configuration = 'func'
            end
          end

          def end_element(name)
            case @configuration
            when 'topic'
              case name
              when 'Id', 'Event', 'Topic'
                @topic[name] = value
              when 'TopicConfiguration'
                @response['Topics'] << @topic
                @topic = {}
              end
            when 'queue'
              case name
              when 'Id', 'Queue', 'Event'
                @queue[name] = value
              when 'QueueConfiguration'
                @response['Queues'] << @queue
                @queue = {}
              end
            when 'func'
              case name
              when 'Id', 'CloudFunction', 'InvocationRule', 'Event'
                @func[name] = value
              when 'CloudFunctionConfiguration'
                @response['CloudFunctions'] << @func
                @func = {}
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

45 entries across 43 versions & 3 rubygems

Version Path
fog-aws-0.1.0 lib/fog/aws/parsers/storage/get_bucket_notification.rb
fog-aws-0.0.8 lib/fog/aws/parsers/storage/get_bucket_notification.rb
fog-aws-0.0.7 lib/fog/aws/parsers/storage/get_bucket_notification.rb
fog-aws-0.0.6 lib/fog/aws/parsers/storage/get_bucket_notification.rb
fog-aws-0.0.5 lib/fog/aws/parsers/storage/get_bucket_notification.rb