Sha256: 1597dab9357d8ac87fdb21399915334dddde6009eac0df6420a0a034b6927f0c
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb index 5186416..490bc91 100644 --- a/lib/slack/web/api/endpoints/chat.rb +++ b/lib/slack/web/api/endpoints/chat.rb @@ -154,9 +154,15 @@ module Slack # @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.update.json def chat_update(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? - throw ArgumentError.new('Required arguments :text missing') if options[:text].nil? + throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil? throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil? options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel] + # 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.update', options) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slack-ruby-client-0.10.0 | lib/slack/web/api/patches/chat.3.update-attachments-support.patch |
slack-ruby-client-0.9.1 | lib/slack/web/api/patches/chat.3.update-attachments-support.patch |