Sha256: a4569aeb2aa67dcf62ca3d54c89cd4cfa24ea68ea16a2536e6b64eec090c06fd
Contents?: true
Size: 725 Bytes
Versions: 4
Compression:
Stored size: 725 Bytes
Contents
require 'securerandom' module FakeSQS class Message attr_reader :body, :id, :md5 attr_accessor :visibility_timeout def initialize(options = {}) @body = options.fetch("MessageBody") @id = options.fetch("Id") { SecureRandom.uuid } @md5 = options.fetch("MD5") { Digest::MD5.hexdigest(@body) } end def expire! self.visibility_timeout = nil end def expired?( limit = Time.now ) self.visibility_timeout.nil? || self.visibility_timeout < limit end def expire_at(seconds) self.visibility_timeout = Time.now + seconds end def attributes { "MessageBody" => body, "Id" => id, "MD5" => md5, } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fake_sqs-0.3.1 | lib/fake_sqs/message.rb |
fake_sqs-0.3.0 | lib/fake_sqs/message.rb |
fake_sqs-0.2.0 | lib/fake_sqs/message.rb |
fake_sqs-0.1.0 | lib/fake_sqs/message.rb |