Class: Messenger::Parameters::Message
- Inherits:
-
Object
- Object
- Messenger::Parameters::Message
- Includes:
- Callback
- Defined in:
- lib/messenger/parameters/message.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#attachments ⇒ Object
Returns the value of attribute attachments.
-
#is_echo ⇒ Object
Returns the value of attribute is_echo.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#mid ⇒ Object
Returns the value of attribute mid.
-
#quick_reply ⇒ Object
Returns the value of attribute quick_reply.
-
#seq ⇒ Object
Returns the value of attribute seq.
-
#sticker_id ⇒ Object
Returns the value of attribute sticker_id.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #build_attachments(attachments) ⇒ Object
- #build_quick_reply(quick_reply) ⇒ Object
-
#initialize(mid:, seq:, sticker_id: nil, text: nil, attachments: nil, quick_reply: nil, is_echo: nil, app_id: nil, metadata: nil) ⇒ Message
constructor
A new instance of Message.
Methods included from Callback
Constructor Details
#initialize(mid:, seq:, sticker_id: nil, text: nil, attachments: nil, quick_reply: nil, is_echo: nil, app_id: nil, metadata: nil) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/messenger/parameters/message.rb', line 8 def initialize(mid:, seq:, sticker_id: nil, text: nil, attachments: nil, quick_reply: nil, is_echo: nil, app_id: nil, metadata: nil) @mid = mid @seq = seq @sticker_id = sticker_id if sticker_id.present? @text = text if text.present? @attachments = () if .present? @quick_reply = build_quick_reply(quick_reply) if quick_reply.present? @is_echo = is_echo @app_id = app_id @metadata = end |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def app_id @app_id end |
#attachments ⇒ Object
Returns the value of attribute attachments.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def @attachments end |
#is_echo ⇒ Object
Returns the value of attribute is_echo.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def is_echo @is_echo end |
#metadata ⇒ Object
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def @metadata end |
#mid ⇒ Object
Returns the value of attribute mid.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def mid @mid end |
#quick_reply ⇒ Object
Returns the value of attribute quick_reply.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def quick_reply @quick_reply end |
#seq ⇒ Object
Returns the value of attribute seq.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def seq @seq end |
#sticker_id ⇒ Object
Returns the value of attribute sticker_id.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def sticker_id @sticker_id end |
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/messenger/parameters/message.rb', line 6 def text @text end |
Instance Method Details
#build_attachments(attachments) ⇒ Object
20 21 22 |
# File 'lib/messenger/parameters/message.rb', line 20 def () .map { || Attachment.new(.transform_keys(&:to_sym).slice(:type, :payload)) } end |
#build_quick_reply(quick_reply) ⇒ Object
24 25 26 |
# File 'lib/messenger/parameters/message.rb', line 24 def build_quick_reply(quick_reply) QuickReply.new(quick_reply.transform_keys(&:to_sym)) end |