class MessengerPlatform::InboundMessage
Attributes
attachments[RW]
message_id[RW]
recipient[RW]
sender[RW]
sequence[RW]
source_data[RW]
text[RW]
timestamp[RW]
Public Class Methods
new(hash)
click to toggle source
# File lib/messenger_platform/inbound_message.rb, line 6 def initialize(hash) @source_data = hash @sender = MessengerPlatform::Contact.new(hash[:sender]) @recipient = MessengerPlatform::Contact.new(hash[:recipient]) @timestamp = hash[:timestamp] @message_id = message[:mid] @sequence = message[:seq] @text = message[:text] @attachments = parse_attachments end
Public Instance Methods
attachments?()
click to toggle source
# File lib/messenger_platform/inbound_message.rb, line 18 def attachments? attachments.any? end
Private Instance Methods
message()
click to toggle source
# File lib/messenger_platform/inbound_message.rb, line 30 def message source_data.fetch(:message, {}) end
parse_attachments()
click to toggle source
# File lib/messenger_platform/inbound_message.rb, line 24 def parse_attachments message.fetch(:attachments, []).map do |attachment| MessengerPlatform::Attachment.new(attachment) end end