Sha256: dcc394f910cbe57e94f994d032d4de9f2ffa30e2ae57300ee08e59e509008884

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

module FakeSQS
  module Actions
    class ReceiveMessage

      def initialize(options = {})
        @server    = options.fetch(:server)
        @queues    = options.fetch(:queues)
        @responder = options.fetch(:responder)
      end

      def call(name, params)
        queue = @queues.get(name)
        messages = queue.receive_message(params)
        @responder.call :ReceiveMessage do |xml|
          messages.each do |receipt, message|
            xml.Message do
              xml.MessageId message.id
              xml.ReceiptHandle receipt
              xml.MD5OfMessageBody message.md5
              xml.Body message.body
            end
          end
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fake_sqs-0.0.5 lib/fake_sqs/actions/receive_message.rb
fake_sqs-0.0.4 lib/fake_sqs/actions/receive_message.rb