Sha256: d294fc2abf72df88f8a8f84ec6cc4af318d9555050d41b4ba2d407a8dd3a2442

Contents?: true

Size: 357 Bytes

Versions: 4

Compression:

Stored size: 357 Bytes

Contents

require "base64"

module Jets::Event::Helpers
  module KinesisEvent
    def kinesis_data
      records = event["Records"]
      records.map do |record|
        encoded = record["kinesis"]["data"]
        Base64.decode64(encoded) # data
      end
    end

    def kinesis_data?
      event["Records"]&.any? { |r| r.dig("kinesis", "data") }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/event/helpers/kinesis_event.rb
jets-6.0.4 lib/jets/event/helpers/kinesis_event.rb
jets-6.0.3 lib/jets/event/helpers/kinesis_event.rb
jets-6.0.2 lib/jets/event/helpers/kinesis_event.rb