Sha256: 5204a68514d579469a1b2c1aed42c9181d3ce94660d4b8748aa44d9c90b4fca6

Contents?: true

Size: 914 Bytes

Versions: 14

Compression:

Stored size: 914 Bytes

Contents

diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
index 846126e..0c254c6 100644
--- a/lib/slack/web/api/endpoints/chat.rb
+++ b/lib/slack/web/api/endpoints/chat.rb
@@ -62,6 +62,12 @@ module Slack
             throw ArgumentError.new('Required arguments :text missing') if options[:text].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
             post('chat.postEphemeral', options)
           end
 

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
slack-ruby-client-0.14.6 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.14.5 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.14.4 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.14.3 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.14.2 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.14.1 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.14.0 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.13.1 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.13.0 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.12.0 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.11.1 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.11.0 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.10.0 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch
slack-ruby-client-0.9.1 lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch