Class: AgUiProtocol::Core::Events::RawEvent
- Inherits:
-
BaseEvent
- Object
- Types::Model
- BaseEvent
- AgUiProtocol::Core::Events::RawEvent
- Defined in:
- lib/ag_ui_protocol/core/events.rb
Overview
Used to pass through events from external systems.
“‘ruby event = AgUiProtocol::Core::Events::RawEvent.new(event: { “type” => “my_event”, “data” => { “a” => 1 } }, source: “my_source”) “`
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Attributes inherited from BaseEvent
Instance Method Summary collapse
-
#initialize(event:, source: nil, timestamp: nil, raw_event: nil) ⇒ RawEvent
constructor
A new instance of RawEvent.
- #to_h ⇒ Object
Methods inherited from Types::Model
Constructor Details
#initialize(event:, source: nil, timestamp: nil, raw_event: nil) ⇒ RawEvent
Returns a new instance of RawEvent.
812 813 814 815 816 |
# File 'lib/ag_ui_protocol/core/events.rb', line 812 def initialize(event:, source: nil, timestamp: nil, raw_event: nil) super(type: EventType::RAW, timestamp: , raw_event: raw_event) @event = event @source = source end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
802 803 804 |
# File 'lib/ag_ui_protocol/core/events.rb', line 802 def event @event end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
805 806 807 |
# File 'lib/ag_ui_protocol/core/events.rb', line 805 def source @source end |
Instance Method Details
#to_h ⇒ Object
819 820 821 822 |
# File 'lib/ag_ui_protocol/core/events.rb', line 819 def to_h # `event` is the raw upstream event payload — preserve keys verbatim. super.merge(event: @event.nil? ? nil : AgUiProtocol::Util::Opaque.new(@event), source: @source) end |