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
# File 'lib/messenger_platform/inbound_message.rb', line 6

def initialize(hash)
  @source_data = hash
  @sender = MessengerPlatform::Contact.new(hash.fetch(:sender))
  @recipient = MessengerPlatform::Contact.new(hash.fetch(:recipient))
  @timestamp = hash.fetch(:timestamp)

  @message_id = message.fetch(:mid)
  @sequence = message.fetch(:seq)
  @text = message.fetch(:text)
end

Instance Attribute Details

#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