Class: MessageQuickly::Messaging::MessageEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/message_quickly/messaging/message_event.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#entry, #recipient, #sender, #timestamp

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ MessageEvent

Returns a new instance of MessageEvent.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/message_quickly/messaging/message_event.rb', line 9

def initialize(params = {})

  @attachments = params[:message].delete(:attachments).collect { |attachment_params| Attachment.new(attachment_params) } if params.dig(:message, :attachments)
  @attachments ||= []

  @quick_reply = QuickReply.new(params[:message][:quick_reply]) if params.dig(:message, :quick_reply)

  if params.include? :message
    @mid = params[:message][:mid]
    @seq = params[:message][:seq]
    @is_echo = params[:message][:is_echo]
    @text = params[:message][:text]
    params.delete(:message)
  end

  super(params)

end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments.



7
8
9
# File 'lib/message_quickly/messaging/message_event.rb', line 7

def attachments
  @attachments
end

#midObject (readonly)

Returns the value of attribute mid.



7
8
9
# File 'lib/message_quickly/messaging/message_event.rb', line 7

def mid
  @mid
end

#quick_replyObject (readonly)

Returns the value of attribute quick_reply.



7
8
9
# File 'lib/message_quickly/messaging/message_event.rb', line 7

def quick_reply
  @quick_reply
end

#seqObject (readonly)

Returns the value of attribute seq.



7
8
9
# File 'lib/message_quickly/messaging/message_event.rb', line 7

def seq
  @seq
end

#textObject (readonly)

Returns the value of attribute text.



7
8
9
# File 'lib/message_quickly/messaging/message_event.rb', line 7

def text
  @text
end

Instance Method Details

#is_echo?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/message_quickly/messaging/message_event.rb', line 32

def is_echo?
  @is_echo
end

#webhook_nameObject



28
29
30
# File 'lib/message_quickly/messaging/message_event.rb', line 28

def webhook_name
  :messages
end