Sha256: aa6774d460ff35497ab85131d838325b7966f7cba4fe2000fe08efcfdaa7a686

Contents?: true

Size: 1.87 KB

Versions: 32

Compression:

Stored size: 1.87 KB

Contents

module Fog
  module Parsers
    module AWS
      module CDN

        class GetDistributionList < Fog::Parsers::Base

          def reset
            @distribution_summary = { 'CNAME' => [], 'TrustedSigners' => [] }
            @response = { 'DistributionSummary' => [] }
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'CustomOrigin', 'S3Origin'
              @origin = name
              @distribution_summary[@origin] = {}
            end
          end

          def end_element(name)
            case name
            when 'DistributionSummary'
              @response['DistributionSummary'] << @distribution_summary
              @distribution_summary = { 'CNAME' => [], 'TrustedSigners' => [] }
            when 'Comment', 'DomainName', 'Id', 'Origin', 'Status'
              @distribution_summary[name] = @value
            when 'CNAME'
              @distribution_summary[name] << @value
            when 'DNSName', 'OriginAccessIdentity', 'OriginProtocolPolicy'
              @distribution_summary[@origin][name] = @value
            when 'Enabled'
              if @value == 'true'
                @distribution_summary[name] = true
              else
                @distribution_summary[name] = false
              end
            when 'HTTPPort', 'HTTPSPort'
              @distribution_summary[@origin][name] = @value.to_i
            when 'LastModifiedTime'
              @distribution_summary[name] = Time.parse(@value)
            when 'IsTruncated'
              if @value == 'true'
                @response[name] = true
              else
                @response[name] = false
              end
            when 'Marker', 'NextMarker'
              @response[name] = @value
            when 'MaxItems'
              @response[name] = @value.to_i
            end
          end

        end

      end
    end
  end
end

Version data entries

32 entries across 32 versions & 3 rubygems

Version Path
fog-0.7.2 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.7.1 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.7.0 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.6.0 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.5.3 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.5.2 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.5.1 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.5.0 lib/fog/cdn/parsers/aws/get_distribution_list.rb
phpfog-fog-0.4.1.3 lib/fog/cdn/parsers/aws/get_distribution_list.rb
phpfog-fog-0.4.1.2 lib/fog/cdn/parsers/aws/get_distribution_list.rb
phpfog-fog-0.4.1.1 lib/fog/cdn/parsers/aws/get_distribution_list.rb
phpfog-fog-0.4.1 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.4.1 lib/fog/cdn/parsers/aws/get_distribution_list.rb
fog-0.4.0 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-0.3.34 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-0.3.33 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-0.3.32 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-0.3.31 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-0.3.30 lib/fog/aws/parsers/cdn/get_distribution_list.rb
fog-0.3.29 lib/fog/aws/parsers/cdn/get_distribution_list.rb