Class: Messenger::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/messenger/params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Params

Returns a new instance of Params.



5
6
7
# File 'lib/messenger/params.rb', line 5

def initialize(params)
  @params = params
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



3
4
5
# File 'lib/messenger/params.rb', line 3

def params
  @params
end

Instance Method Details

#attachmentsObject



21
22
23
# File 'lib/messenger/params.rb', line 21

def attachments
  messaging_entry['message']['attachments'].map { |a| a['payload']['url'] }
end

#delivery?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/messenger/params.rb', line 13

def delivery?
  messaging_entry.key?('delivery')
end

#message?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/messenger/params.rb', line 9

def message?
  messaging_entry.key?('message')
end

#postback?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/messenger/params.rb', line 17

def postback?
  messaging_entry.key?('postback')
end

#recipient_idObject



33
34
35
# File 'lib/messenger/params.rb', line 33

def recipient_id
  messaging_entry['recipient']['id']
end

#sender_idObject



29
30
31
# File 'lib/messenger/params.rb', line 29

def sender_id
  messaging_entry['sender']['id']
end

#text_messageObject



25
26
27
# File 'lib/messenger/params.rb', line 25

def text_message
  messaging_entry['message']['text']
end