Sha256: 6f3c90a7005d968c9545780834d11e5d87828538d4343872aae3cb1bc076c719

Contents?: true

Size: 893 Bytes

Versions: 69

Compression:

Stored size: 893 Bytes

Contents

module Fog
  module AWS
    module Parsers
      module Lambda
        class Base
          def process(body)
            body.inject({}) { |h, (k, v)| h[k] = rules(k, v); h }
          end

          private

          def rules(key, value)
            case value
            when Hash
              process(value)
            when Array
              value.map { |i| process(i) }
            else
              case key
              when 'LastModified'
                Time.parse(value)
              when 'Policy', 'Statement'
                begin
                  Fog::JSON.decode(value)
                rescue Fog::JSON::DecodeError => e
                  Fog::Logger.warning("Error parsing response json - #{e}")
                  {}
                end
              else
                value
              end
            end
          end

        end
      end
    end
  end
end

Version data entries

69 entries across 67 versions & 3 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.29.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.28.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.27.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.26.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.25.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.24.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.23.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.22.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.21.1 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.21.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.20.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.19.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.18.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.17.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.16.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.15.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.14.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.13.0 lib/fog/aws/parsers/lambda/base.rb
fog-aws-3.12.0 lib/fog/aws/parsers/lambda/base.rb