Sha256: ebe4dd29448c84de018c4bd879d7caefaf75c81f4cd02aeb97b00cac4c01a11e

Contents?: true

Size: 423 Bytes

Versions: 2

Compression:

Stored size: 423 Bytes

Contents

require 'securerandom'

module FakeSQS
  class Message

    attr_reader :body, :id, :md5

    def initialize(options = {})
      @body = options.fetch("MessageBody")
      @id = options.fetch("Id") { SecureRandom.uuid }
      @md5 = options.fetch("MD5") { Digest::MD5.hexdigest(@body) }
    end

    def attributes
      {
        "MessageBody" => body,
        "Id" => id,
        "MD5" => md5,
      }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fake_sqs-0.0.11 lib/fake_sqs/message.rb
fake_sqs-0.0.10 lib/fake_sqs/message.rb