Class: FakeSQS::Actions::ChangeMessageVisibilityBatch
- Inherits:
-
Object
- Object
- FakeSQS::Actions::ChangeMessageVisibilityBatch
- Defined in:
- lib/fake_sqs/actions/change_message_visibility_batch.rb
Instance Method Summary collapse
- #call(queue_name, params) ⇒ Object
-
#initialize(options = {}) ⇒ ChangeMessageVisibilityBatch
constructor
A new instance of ChangeMessageVisibilityBatch.
Constructor Details
#initialize(options = {}) ⇒ ChangeMessageVisibilityBatch
Returns a new instance of ChangeMessageVisibilityBatch.
5 6 7 8 |
# File 'lib/fake_sqs/actions/change_message_visibility_batch.rb', line 5 def initialize( = {}) @queues = .fetch(:queues) @responder = .fetch(:responder) end |
Instance Method Details
#call(queue_name, params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fake_sqs/actions/change_message_visibility_batch.rb', line 10 def call(queue_name, params) queue = @queues.get(queue_name) keys = params.keys.map do |key| case key when /^ChangeMessageVisibilityBatchRequestEntry\.(\w+)\.Id$/ $1 end end.compact ids = keys.map do |key| receipt = params.fetch("ChangeMessageVisibilityBatchRequestEntry.#{key}.ReceiptHandle") timeout = params.fetch("ChangeMessageVisibilityBatchRequestEntry.#{key}.VisibilityTimeout").to_i queue.(receipt, timeout) params.fetch("ChangeMessageVisibilityBatchRequestEntry.#{key}.Id") end @responder.call :ChangeMessageVisibilityBatch do |xml| ids.each do |id| xml.ChangeMessageVisibilityBatchResultEntry do xml.Id id end end end end |