Class: Facebook::Messenger::Incoming::Postback

Inherits:
Object
  • Object
show all
Defined in:
lib/facebook/messenger/incoming/postback.rb

Overview

The Postback class represents an incoming Facebook Messenger postback.

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Postback

Returns a new instance of Postback.



6
7
8
# File 'lib/facebook/messenger/incoming/postback.rb', line 6

def initialize(payload)
  @payload = payload
end

Instance Method Details

#payloadObject



22
23
24
# File 'lib/facebook/messenger/incoming/postback.rb', line 22

def payload
  @payload['postback']['payload']
end

#recipientObject



14
15
16
# File 'lib/facebook/messenger/incoming/postback.rb', line 14

def recipient
  @payload['recipient']
end

#senderObject



10
11
12
# File 'lib/facebook/messenger/incoming/postback.rb', line 10

def sender
  @payload['sender']
end

#sent_atObject



18
19
20
# File 'lib/facebook/messenger/incoming/postback.rb', line 18

def sent_at
  Time.at(@payload['timestamp'] / 1000)
end