Class: Pwwka::TestHandler::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/pwwka/test_handler.rb

Overview

Simple class to hold a popped message.

You can either access the message contents directly, or splat it for the most commonly-needed aspects:

delivery_info, payload = @test_handler.pop_message

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delivery_info, properties, payload) ⇒ Message

Returns a new instance of Message.



85
86
87
88
89
90
# File 'lib/pwwka/test_handler.rb', line 85

def initialize(delivery_info, properties, payload)
  @delivery_info = delivery_info
  @properties = properties
  @raw_payload = payload
  @payload = JSON.parse(@raw_payload)
end

Instance Attribute Details

#delivery_infoObject (readonly)

Returns the value of attribute delivery_info.



84
85
86
# File 'lib/pwwka/test_handler.rb', line 84

def delivery_info
  @delivery_info
end

#payloadObject (readonly)

Returns the value of attribute payload.



84
85
86
# File 'lib/pwwka/test_handler.rb', line 84

def payload
  @payload
end

#propertiesObject (readonly)

Returns the value of attribute properties.



84
85
86
# File 'lib/pwwka/test_handler.rb', line 84

def properties
  @properties
end

Instance Method Details

#to_aryObject

Returns the delivery_info, payload, properties, and raw_payload for splat magic.



94
95
96
# File 'lib/pwwka/test_handler.rb', line 94

def to_ary
  [@delivery_info,@payload,@properties,@raw_payload]
end