Class: Slack::Surfaces::Message
- Inherits:
-
Object
- Object
- Slack::Surfaces::Message
- Defined in:
- lib/slack/surfaces/message.rb
Overview
App-published messages are dynamic yet transient spaces. They allow users to complete workflows among their Slack conversations.
api.slack.com/surfaces#messages api.slack.com/messaging/composing#complex_layouts
Constant Summary collapse
- TYPE =
'message'
Instance Attribute Summary collapse
-
#blocks ⇒ Object
readonly
Returns the value of attribute blocks.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(blocks: nil, text: nil, channel: nil, thread_ts: nil, as_user: nil) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(blocks: nil, text: nil, channel: nil, thread_ts: nil, as_user: nil) ⇒ Message
Returns a new instance of Message.
13 14 15 16 17 18 19 |
# File 'lib/slack/surfaces/message.rb', line 13 def initialize(blocks: nil, text: nil, channel: nil, thread_ts: nil, as_user: nil) @blocks = blocks || Slack::BlockKit::Blocks.new @channel = channel @thread_ts = thread_ts @as_user = as_user @text = text end |
Instance Attribute Details
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
21 22 23 |
# File 'lib/slack/surfaces/message.rb', line 21 def blocks @blocks end |
Instance Method Details
#as_json ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/slack/surfaces/message.rb', line 23 def as_json(*) { channel: @channel, thread_ts: @thread_ts, as_user: @as_user, text: @text, blocks: @blocks.as_json }.compact end |