Class: Honker::StreamEvent

Inherits:
Struct
  • Object
show all
Defined in:
lib/honker/stream.rb

Overview

One event in a stream. ‘payload` is already JSON-decoded.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



97
98
99
# File 'lib/honker/stream.rb', line 97

def created_at
  @created_at
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



97
98
99
# File 'lib/honker/stream.rb', line 97

def key
  @key
end

#offsetObject

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



97
98
99
# File 'lib/honker/stream.rb', line 97

def offset
  @offset
end

#payloadObject

Returns the value of attribute payload

Returns:

  • (Object)

    the current value of payload



97
98
99
# File 'lib/honker/stream.rb', line 97

def payload
  @payload
end

#topicObject

Returns the value of attribute topic

Returns:

  • (Object)

    the current value of topic



97
98
99
# File 'lib/honker/stream.rb', line 97

def topic
  @topic
end

Class Method Details

.from_row(row) ⇒ Object



98
99
100
101
102
103
104
105
106
# File 'lib/honker/stream.rb', line 98

def self.from_row(row)
  new(
    row["offset"],
    row["topic"],
    row["key"],
    row["payload"].nil? ? nil : JSON.parse(row["payload"]),
    row["created_at"],
  )
end