Class: Hahamut::Event

Inherits:
Object
  • Object
show all
Includes:
Support::Attributes
Defined in:
lib/hahamut/event.rb

Overview

Hahamut Webhook Event

Instance Attribute Summary

Attributes included from Support::Attributes

#attributes

Instance Method Summary collapse

Methods included from Support::Attributes

#assign_attributes, included

Constructor Details

#initialize(attributes) ⇒ Event

Returns a new instance of Event.



11
12
13
14
15
# File 'lib/hahamut/event.rb', line 11

def initialize(attributes)
  assign_attributes(attributes)

  @attributes[:messaging] ||= []
end

Instance Method Details

#messagingObject



17
18
19
# File 'lib/hahamut/event.rb', line 17

def messaging
  @attributes[:messaging]
end

#messaging=(messages) ⇒ Object



21
22
23
24
25
26
# File 'lib/hahamut/event.rb', line 21

def messaging=(messages)
  @attributes[:messaging] =
    messages
    &.map { |message| Message.parse(message) }
    &.compact
end