Class: MicroBunny::Payload
- Inherits:
-
Object
- Object
- MicroBunny::Payload
- Defined in:
- lib/microbunny/payload.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
Returns the value of attribute event.
-
#message ⇒ Object
Returns the value of attribute message.
-
#record ⇒ Object
Returns the value of attribute record.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(event:, message:, record: nil) ⇒ Payload
constructor
A new instance of Payload.
- #serialize ⇒ Object
Constructor Details
#initialize(event:, message:, record: nil) ⇒ Payload
Returns a new instance of Payload.
11 12 13 14 15 |
# File 'lib/microbunny/payload.rb', line 11 def initialize(event:, message:, record: nil) @event = event @message = @record = record end |
Instance Attribute Details
#event ⇒ Object
Returns the value of attribute event.
5 6 7 |
# File 'lib/microbunny/payload.rb', line 5 def event @event end |
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/microbunny/payload.rb', line 5 def @message end |
#record ⇒ Object
Returns the value of attribute record.
5 6 7 |
# File 'lib/microbunny/payload.rb', line 5 def record @record end |
Class Method Details
.deserialize(json) ⇒ Object
7 8 9 |
# File 'lib/microbunny/payload.rb', line 7 def self.deserialize(json) new JSON.parse(json, symbolize_names: true) end |
Instance Method Details
#serialize ⇒ Object
17 18 19 |
# File 'lib/microbunny/payload.rb', line 17 def serialize {event: event, message: , record: record}.to_json end |