Class: Events::UserMessage

Inherits:
Base
  • Object
show all
Defined in:
lib/events/user_message.rb

Constant Summary collapse

TYPE =
"user_message"

Instance Attribute Summary collapse

Attributes inherited from Base

#content, #session_id, #timestamp

Instance Method Summary collapse

Methods inherited from Base

#event_name

Constructor Details

#initialize(content:, session_id: nil, status: nil) ⇒ UserMessage

Returns a new instance of UserMessage.

Parameters:

  • content (String)

    message text

  • session_id (Integer, nil) (defaults to: nil)

    session identifier

  • status (String, nil) (defaults to: nil)

    “pending” when queued during active agent processing



13
14
15
16
# File 'lib/events/user_message.rb', line 13

def initialize(content:, session_id: nil, status: nil)
  super(content: content, session_id: session_id)
  @status = status
end

Instance Attribute Details

#statusString? (readonly)

Returns “pending” when queued during active processing, nil otherwise.

Returns:

  • (String, nil)

    “pending” when queued during active processing, nil otherwise



8
9
10
# File 'lib/events/user_message.rb', line 8

def status
  @status
end

Instance Method Details

#to_hObject



22
23
24
25
26
# File 'lib/events/user_message.rb', line 22

def to_h
  h = super
  h[:status] = status if status
  h
end

#typeObject



18
19
20
# File 'lib/events/user_message.rb', line 18

def type
  TYPE
end