Module: Slack::Web::Im

Included in:
Slack::Web
Defined in:
lib/slack/web/im.rb

Constant Summary collapse

SCOPE =
"im"

Instance Method Summary collapse

Instance Method Details

#im_close(params = {}) ⇒ Object

Close a direct message channel.



7
8
9
10
11
# File 'lib/slack/web/im.rb', line 7

def im_close(params={})
  throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
  response = @session.do_get "#{SCOPE}.close", params
  Slack::parse_response(response)
end

#im_history(params = {}) ⇒ Object

Fetches history of messages and events from direct message channel.



14
15
16
17
18
# File 'lib/slack/web/im.rb', line 14

def im_history(params={})
  throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
  response = @session.do_get "#{SCOPE}.history", params
  Slack::parse_response(response)
end

#im_list(params = {}) ⇒ Object

Lists direct message channels for the calling user.



21
22
23
24
# File 'lib/slack/web/im.rb', line 21

def im_list(params={})
  response = @session.do_get "#{SCOPE}.list", params
  Slack::parse_response(response)
end

#im_mark(params = {}) ⇒ Object

Sets the read cursor in a direct message channel.



27
28
29
30
31
32
# File 'lib/slack/web/im.rb', line 27

def im_mark(params={})
  throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
  throw ArgumentError.new("Required arguments :ts missing") if params['ts'].nil?
  response = @session.do_get "#{SCOPE}.mark", params
  Slack::parse_response(response)
end

#im_open(params = {}) ⇒ Object

Opens a direct message channel.



35
36
37
38
39
# File 'lib/slack/web/im.rb', line 35

def im_open(params={})
  throw ArgumentError.new("Required arguments :user missing") if params['user'].nil?
  response = @session.do_get "#{SCOPE}.open", params
  Slack::parse_response(response)
end