module Slack::Web::Api::Endpoints::Chat
def chat_postEphemeral(options = {})
- See: https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json -
See: https://api.slack.com/methods/chat.postEphemeral -
Options Hash:
(**options)
-
:username
(Object
) -- -
:thread_ts
(Object
) -- -
:parse
(Object
) -- -
:link_names
(Object
) -- -
:icon_url
(Object
) -- -
:icon_emoji
(Object
) -- -
:blocks
(Object
) -- -
:as_user
(Object
) -- -
:user
(user
) -- -
:text
(Object
) -- -
:channel
(channel
) -- -
:attachments
(Object
) --
def chat_postEphemeral(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil? throw ArgumentError.new('Required arguments :user missing') if options[:user].nil? options = options.merge(user: users_id(options)['user']['id']) if options[:user] # attachments must be passed as an encoded JSON string if options.key?(:attachments) attachments = options[:attachments] attachments = JSON.dump(attachments) unless attachments.is_a?(String) options = options.merge(attachments: attachments) end # blocks must be passed as an encoded JSON string if options.key?(:blocks) blocks = options[:blocks] blocks = JSON.dump(blocks) unless blocks.is_a?(String) options = options.merge(blocks: blocks) end post('chat.postEphemeral', options) end