Class: Shikibu::Channels::Message
- Inherits:
-
Object
- Object
- Shikibu::Channels::Message
- Defined in:
- lib/shikibu/channels.rb
Overview
Message wrapper with metadata
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#published_at ⇒ Object
readonly
Returns the value of attribute published_at.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(id:, channel:, data:, metadata: nil, published_at: nil) ⇒ Message
constructor
A new instance of Message.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, channel:, data:, metadata: nil, published_at: nil) ⇒ Message
Returns a new instance of Message.
41 42 43 44 45 46 47 |
# File 'lib/shikibu/channels.rb', line 41 def initialize(id:, channel:, data:, metadata: nil, published_at: nil) @id = id @channel = channel @data = data = || {} @published_at = published_at end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
39 40 41 |
# File 'lib/shikibu/channels.rb', line 39 def channel @channel end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
39 40 41 |
# File 'lib/shikibu/channels.rb', line 39 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
39 40 41 |
# File 'lib/shikibu/channels.rb', line 39 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
39 40 41 |
# File 'lib/shikibu/channels.rb', line 39 def end |
#published_at ⇒ Object (readonly)
Returns the value of attribute published_at.
39 40 41 |
# File 'lib/shikibu/channels.rb', line 39 def published_at @published_at end |
Instance Method Details
#[](key) ⇒ Object
49 50 51 |
# File 'lib/shikibu/channels.rb', line 49 def [](key) @data[key] end |
#to_h ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/shikibu/channels.rb', line 53 def to_h { id: @id, channel: @channel, data: @data, metadata: , published_at: @published_at } end |