Sha256: 9bfc481477b4451d9c08bbdfba0b4925f670bba44755a868cee59ec1681a61ee
Contents?: true
Size: 915 Bytes
Versions: 36
Compression:
Stored size: 915 Bytes
Contents
diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb index 1f7a8d7..89b1562 100644 --- a/lib/slack/web/api/endpoints/chat.rb +++ b/lib/slack/web/api/endpoints/chat.rb @@ -50,6 +50,12 @@ module Slack def chat_postMessage(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil? + # 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.postMessage', options) end
Version data entries
36 entries across 36 versions & 2 rubygems