lib/fake_sqs/message.rb in fake_sqs-0.0.9 vs lib/fake_sqs/message.rb in fake_sqs-0.0.10

- old
+ new

@@ -1,21 +1,23 @@ require 'securerandom' module FakeSQS class Message - attr_reader :body + 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 id - @id ||= SecureRandom.uuid - end - - def md5 - @md5 ||= Digest::MD5.hexdigest(body) + def attributes + { + "MessageBody" => body, + "Id" => id, + "MD5" => md5, + } end end end