Class: Messenger::Params
- Inherits:
-
Object
- Object
- Messenger::Params
- Defined in:
- lib/messenger/params.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #attachments ⇒ Object
- #delivery? ⇒ Boolean
-
#initialize(params) ⇒ Params
constructor
A new instance of Params.
- #message? ⇒ Boolean
- #postback? ⇒ Boolean
- #recipient_id ⇒ Object
- #sender_id ⇒ Object
- #text_message ⇒ Object
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
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/messenger/params.rb', line 3 def params @params end |
Instance Method Details
#attachments ⇒ Object
21 22 23 |
# File 'lib/messenger/params.rb', line 21 def messaging_entry['message']['attachments'].map { |a| a['payload']['url'] } end |
#delivery? ⇒ Boolean
13 14 15 |
# File 'lib/messenger/params.rb', line 13 def delivery? messaging_entry.key?('delivery') end |
#message? ⇒ Boolean
9 10 11 |
# File 'lib/messenger/params.rb', line 9 def messaging_entry.key?('message') end |
#postback? ⇒ Boolean
17 18 19 |
# File 'lib/messenger/params.rb', line 17 def postback? messaging_entry.key?('postback') end |
#recipient_id ⇒ Object
33 34 35 |
# File 'lib/messenger/params.rb', line 33 def recipient_id messaging_entry['recipient']['id'] end |
#sender_id ⇒ Object
29 30 31 |
# File 'lib/messenger/params.rb', line 29 def sender_id messaging_entry['sender']['id'] end |
#text_message ⇒ Object
25 26 27 |
# File 'lib/messenger/params.rb', line 25 def messaging_entry['message']['text'] end |