Method: Slack::Web::Api::Endpoints::Chat#chat_update
- Defined in:
- lib/slack/web/api/endpoints/chat.rb
#chat_update(options = {}) ⇒ Object
Updates a message.
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 282 def chat_update( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if [:text].nil? && [:attachments].nil? && [:blocks].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] # attachments must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end # blocks must be passed as an encoded JSON string if .key?(:blocks) blocks = [:blocks] blocks = JSON.dump(blocks) unless blocks.is_a?(String) = .merge(blocks: blocks) end post('chat.update', ) end |