class Slack::API::Chat

Public Instance Methods

create(text, channel, options={}) click to toggle source
# File lib/laziness/api/chat.rb, line 4
def create(text, channel, options={})
  if (options.has_key?(:attachments))
    attachments = options[:attachments]
    attachments = JSON.dump(attachments) unless attachments.is_a?(String)
    options = options.merge(attachments: attachments)
  end
  response = request :post, 'chat.postMessage', { text: text, channel: channel }.merge(options)
  Slack::Chat.parse response, 'message'
end
delete(channel, timestamp) click to toggle source
# File lib/laziness/api/chat.rb, line 14
def delete(channel, timestamp)
  with_nil_response { request :post, 'chat.delete', ts: timestamp, channel: channel }
end
update(text, channel, timestamp, options={}) click to toggle source
# File lib/laziness/api/chat.rb, line 18
def update(text, channel, timestamp, options={})
  response = request :post, 'chat.update',
    { text: text, channel: channel, ts: timestamp }.merge(options)
  Slack::Chat.parse response, 'message'
end