Class: SimpleAcp::Models::MessageCompletedEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/simple_acp/models/events.rb

Overview

Message completed event

Instance Attribute Summary

Attributes inherited from Event

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

#sse_format

Methods inherited from Base

#==, attribute, attributes, #hash, own_attributes, #to_h, #to_json

Constructor Details

#initialize(**kwargs) ⇒ MessageCompletedEvent

Returns a new instance of MessageCompletedEvent.



68
69
70
71
# File 'lib/simple_acp/models/events.rb', line 68

def initialize(**kwargs)
  kwargs[:type] = Types::EventType::MESSAGE_COMPLETED
  super
end

Class Method Details

.from_hash(hash) ⇒ Object



73
74
75
76
77
78
79
80
81
# File 'lib/simple_acp/models/events.rb', line 73

def self.from_hash(hash)
  return nil if hash.nil?

  instance = super
  if hash["message"] || hash[:message]
    instance.message = Message.from_hash(hash["message"] || hash[:message])
  end
  instance
end