Module: Jets::Event::Helpers::SqsEvent

Extended by:
Memoist
Included in:
Base
Defined in:
lib/jets/event/helpers/sqs_event.rb

Instance Method Summary collapse

Instance Method Details

#sqs_eventsObject



10
11
12
13
14
15
16
# File 'lib/jets/event/helpers/sqs_event.rb', line 10

def sqs_events
  records = sqs_records
  return [] unless records
  records.map do |record|
    JSON.parse(record[:body])
  end
end

#sqs_events?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/jets/event/helpers/sqs_event.rb', line 19

def sqs_events?
  sqs_records&.any? { |r| r.dig(:body) }
end

#sqs_recordsObject



5
6
7
# File 'lib/jets/event/helpers/sqs_event.rb', line 5

def sqs_records
  event[:Records].map { |record| record }
end