Class: SimpleAcp::Models::MessageCreatedEvent

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

Overview

Message created 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) ⇒ MessageCreatedEvent

Returns a new instance of MessageCreatedEvent.



28
29
30
31
# File 'lib/simple_acp/models/events.rb', line 28

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

Class Method Details

.from_hash(hash) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/simple_acp/models/events.rb', line 33

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