Class: MessengerPlatform::InboundMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/messenger_platform/inbound_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ InboundMessage

Returns a new instance of InboundMessage.



6
7
8
9
10
11
12
13
14
15
16
# 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

Instance Attribute Details

#attachmentsObject

Returns the value of attribute attachments.



3
4
5
# File 'lib/messenger_platform/inbound_message.rb', line 3

def attachments
  @attachments
end

#message_idObject

Returns the value of attribute message_id.



3
4
5
# File 'lib/messenger_platform/inbound_message.rb', line 3

def message_id
  @message_id
end

#recipientObject

Returns the value of attribute recipient.



3
4
5
# File 'lib/messenger_platform/inbound_message.rb', line 3

def recipient
  @recipient
end

#senderObject

Returns the value of attribute sender.



3
4
5
# File 'lib/messenger_platform/inbound_message.rb', line 3

def sender
  @sender
end

#sequenceObject

Returns the value of attribute sequence.



3
4
5
# File 'lib/messenger_platform/inbound_message.rb', line 3

def sequence
  @sequence
end

#source_dataObject

Returns the value of attribute source_data.



3
4
5
# File 'lib/messenger_platform/inbound_message.rb', line 3

def source_data
  @source_data
end

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/messenger_platform/inbound_message.rb', line 3

def text
  @text
end

#timestampObject

Returns the value of attribute timestamp.



3
4
5
# File 'lib/messenger_platform/inbound_message.rb', line 3

def timestamp
  @timestamp
end

Instance Method Details

#attachments?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/messenger_platform/inbound_message.rb', line 18

def attachments?
  attachments.any?
end