Class: Shikibu::Channels::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/shikibu/channels.rb

Overview

Message wrapper with metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#channelObject (readonly)

Returns the value of attribute channel.



39
40
41
# File 'lib/shikibu/channels.rb', line 39

def channel
  @channel
end

#dataObject (readonly)

Returns the value of attribute data.



39
40
41
# File 'lib/shikibu/channels.rb', line 39

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



39
40
41
# File 'lib/shikibu/channels.rb', line 39

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



39
40
41
# File 'lib/shikibu/channels.rb', line 39

def 
  
end

#published_atObject (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_hObject



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