Class: Slack::API::Chat

Inherits:
Base
  • Object
show all
Defined in:
lib/laziness/api/chat.rb

Instance Attribute Summary

Attributes inherited from Base

#access_token

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Slack::API::Base

Instance Method Details

#create(text, channel, options = {}) ⇒ Object



4
5
6
7
# File 'lib/laziness/api/chat.rb', line 4

def create(text, channel, options={})
  response = request :post, 'chat.postMessage', { text: text, channel: channel }.merge(options)
  Slack::Chat.parse response, 'message'
end

#delete(channel, timestamp) ⇒ Object



9
10
11
# File 'lib/laziness/api/chat.rb', line 9

def delete(channel, timestamp)
  with_nil_response { request :post, 'chat.delete', ts: timestamp, channel: channel }
end

#update(text, channel, timestamp, options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/laziness/api/chat.rb', line 13

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