slack-ruby-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +6 -0
  6. data/.rubocop_todo.yml +34 -0
  7. data/.travis.yml +6 -0
  8. data/CHANGELOG.md +4 -0
  9. data/CONTRIBUTING.md +139 -0
  10. data/Gemfile +3 -0
  11. data/LICENSE.md +22 -0
  12. data/README.md +123 -0
  13. data/RELEASING.md +67 -0
  14. data/Rakefile +19 -0
  15. data/examples/hi_real_time/Gemfile +3 -0
  16. data/examples/hi_real_time/hi.gif +0 -0
  17. data/examples/hi_real_time/hi.rb +27 -0
  18. data/examples/hi_real_time_and_web/Gemfile +3 -0
  19. data/examples/hi_real_time_and_web/hi.gif +0 -0
  20. data/examples/hi_real_time_and_web/hi.rb +24 -0
  21. data/examples/hi_web/Gemfile +3 -0
  22. data/examples/hi_web/hi.gif +0 -0
  23. data/examples/hi_web/hi.rb +14 -0
  24. data/lib/slack-ruby-client.rb +23 -0
  25. data/lib/slack.rb +1 -0
  26. data/lib/slack/config.rb +17 -0
  27. data/lib/slack/real_time/api/message.rb +20 -0
  28. data/lib/slack/real_time/api/message_id.rb +14 -0
  29. data/lib/slack/real_time/api/ping.rb +16 -0
  30. data/lib/slack/real_time/api/typing.rb +17 -0
  31. data/lib/slack/real_time/client.rb +91 -0
  32. data/lib/slack/real_time/socket.rb +41 -0
  33. data/lib/slack/version.rb +3 -0
  34. data/lib/slack/web/api/endpoints.rb +39 -0
  35. data/lib/slack/web/api/endpoints/api.rb +25 -0
  36. data/lib/slack/web/api/endpoints/auth.rb +21 -0
  37. data/lib/slack/web/api/endpoints/channels.rb +216 -0
  38. data/lib/slack/web/api/endpoints/chat.rb +78 -0
  39. data/lib/slack/web/api/endpoints/emoji.rb +21 -0
  40. data/lib/slack/web/api/endpoints/files.rb +76 -0
  41. data/lib/slack/web/api/endpoints/groups.rb +229 -0
  42. data/lib/slack/web/api/endpoints/im.rb +82 -0
  43. data/lib/slack/web/api/endpoints/oauth.rb +32 -0
  44. data/lib/slack/web/api/endpoints/presence.rb +24 -0
  45. data/lib/slack/web/api/endpoints/rtm.rb +21 -0
  46. data/lib/slack/web/api/endpoints/search.rb +68 -0
  47. data/lib/slack/web/api/endpoints/stars.rb +23 -0
  48. data/lib/slack/web/api/endpoints/users.rb +70 -0
  49. data/lib/slack/web/api/error.rb +8 -0
  50. data/lib/slack/web/api/schema/method.json +45 -0
  51. data/lib/slack/web/api/tasks/generate.rake +37 -0
  52. data/lib/slack/web/api/templates/endpoints.erb +17 -0
  53. data/lib/slack/web/api/templates/method.erb +39 -0
  54. data/lib/slack/web/client.rb +17 -0
  55. data/lib/slack/web/config.rb +36 -0
  56. data/lib/slack/web/faraday/connection.rb +25 -0
  57. data/lib/slack/web/faraday/request.rb +39 -0
  58. data/lib/slack/web/faraday/response/raise_error.rb +14 -0
  59. data/lib/slack_ruby_client.rb +1 -0
  60. data/screenshots/register-bot.png +0 -0
  61. data/slack-ruby-client.gemspec +28 -0
  62. data/spec/fixtures/slack/web/auth_test_error.yml +48 -0
  63. data/spec/fixtures/slack/web/auth_test_success.yml +57 -0
  64. data/spec/fixtures/slack/web/rtm_start.yml +73 -0
  65. data/spec/slack/config_spec.rb +14 -0
  66. data/spec/slack/real_time/api/message_spec.rb +15 -0
  67. data/spec/slack/real_time/api/ping_spec.rb +15 -0
  68. data/spec/slack/real_time/api/typing_spec.rb +15 -0
  69. data/spec/slack/real_time/client_spec.rb +51 -0
  70. data/spec/slack/real_time/socket_spec.rb +42 -0
  71. data/spec/slack/version_spec.rb +7 -0
  72. data/spec/slack/web/api/endpoints/auth_spec.rb +15 -0
  73. data/spec/slack/web/client_spec.rb +31 -0
  74. data/spec/spec_helper.rb +14 -0
  75. data/spec/support/real_time/connected_client.rb +13 -0
  76. data/spec/support/vcr.rb +8 -0
  77. metadata +287 -0
@@ -0,0 +1,78 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Chat
8
+ #
9
+ # Deletes a message.
10
+ #
11
+ # @option options [Object] :ts
12
+ # Timestamp of the message to be deleted.
13
+ # @option options [channel] :channel
14
+ # Channel containing the message to be deleted.
15
+ # @see https://api.slack.com/methods/chat.delete
16
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.delete.md
17
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.delete.json
18
+ def chat_delete(options = {})
19
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
20
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
21
+ post('chat.delete', options)
22
+ end
23
+
24
+ #
25
+ # Sends a message to a channel.
26
+ #
27
+ # @option options [channel] :channel
28
+ # Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
29
+ # @option options [Object] :text
30
+ # Text of the message to send. See below for an explanation of formatting.
31
+ # @option options [Object] :username
32
+ # Name of bot.
33
+ # @option options [Object] :parse
34
+ # Change how messages are treated. See below.
35
+ # @option options [Object] :link_names
36
+ # Find and link channel names and usernames.
37
+ # @option options [Object] :attachments
38
+ # Structured message attachments.
39
+ # @option options [Object] :unfurl_links
40
+ # Pass true to enable unfurling of primarily text-based content.
41
+ # @option options [Object] :unfurl_media
42
+ # Pass false to disable unfurling of media content.
43
+ # @option options [Object] :icon_url
44
+ # URL to an image to use as the icon for this message
45
+ # @option options [Object] :icon_emoji
46
+ # emoji to use as the icon for this message. Overrides `icon_url`.
47
+ # @see https://api.slack.com/methods/chat.postMessage
48
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.postMessage.md
49
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.postMessage.json
50
+ def chat_postMessage(options = {})
51
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
52
+ throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
53
+ post('chat.postMessage', options)
54
+ end
55
+
56
+ #
57
+ # Updates a message.
58
+ #
59
+ # @option options [Object] :ts
60
+ # Timestamp of the message to be updated.
61
+ # @option options [channel] :channel
62
+ # Channel containing the message to be updated.
63
+ # @option options [Object] :text
64
+ # New text for the message, using the [default formatting rules](/docs/formatting).
65
+ # @see https://api.slack.com/methods/chat.update
66
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.update.md
67
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.update.json
68
+ def chat_update(options = {})
69
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
70
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
71
+ throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
72
+ post('chat.update', options)
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Emoji
8
+ #
9
+ # Lists custom emoji for a team.
10
+ #
11
+ # @see https://api.slack.com/methods/emoji.list
12
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/emoji.list.md
13
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/emoji.list.json
14
+ def emoji_list(options = {})
15
+ post('emoji.list', options)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,76 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Files
8
+ #
9
+ # Gets information about a team file.
10
+ #
11
+ # @option options [file] :file
12
+ # File to fetch info for
13
+ # @see https://api.slack.com/methods/files.info
14
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.info.md
15
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.info.json
16
+ def files_info(options = {})
17
+ throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
18
+ post('files.info', options)
19
+ end
20
+
21
+ #
22
+ # Lists & filters team files.
23
+ #
24
+ # @option options [user] :user
25
+ # Filter files created by a single user.
26
+ # @option options [Object] :ts_from
27
+ # Filter files created after this timestamp (inclusive).
28
+ # @option options [Object] :ts_to
29
+ # Filter files created before this timestamp (inclusive).
30
+ # @option options [Object] :types
31
+ # Filter files by type:
32
+ #
33
+ # * `all` - All files
34
+ # * `posts` - Posts
35
+ # * `snippets` - Snippets
36
+ # * `images` - Image files
37
+ # * `gdocs` - Google docs
38
+ # * `zips` - Zip files
39
+ # * `pdfs` - PDF files
40
+ #
41
+ # You can pass multiple values in the types argument, like `types=posts,snippets`.The default value is `all`, which does not filter the list.
42
+ # @see https://api.slack.com/methods/files.list
43
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.list.md
44
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.list.json
45
+ def files_list(options = {})
46
+ post('files.list', options)
47
+ end
48
+
49
+ #
50
+ # Uploads or creates a file.
51
+ #
52
+ # @option options [Object] :file
53
+ # File contents via `multipart/form-data`.
54
+ # @option options [Object] :content
55
+ # File contents via a POST var.
56
+ # @option options [Object] :filetype
57
+ # Slack-internal file type identifier.
58
+ # @option options [Object] :filename
59
+ # Filename of file.
60
+ # @option options [Object] :title
61
+ # Title of file.
62
+ # @option options [Object] :initial_comment
63
+ # Initial comment to add to file.
64
+ # @option options [channel] :channels
65
+ # Comma separated list of channels to share the file into.
66
+ # @see https://api.slack.com/methods/files.upload
67
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.upload.md
68
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.upload.json
69
+ def files_upload(options = {})
70
+ post('files.upload', options)
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,229 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Groups
8
+ #
9
+ # Archives a private group.
10
+ #
11
+ # @option options [group] :channel
12
+ # Private group to archive
13
+ # @see https://api.slack.com/methods/groups.archive
14
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.archive.md
15
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.archive.json
16
+ def groups_archive(options = {})
17
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
18
+ post('groups.archive', options)
19
+ end
20
+
21
+ #
22
+ # Closes a private group.
23
+ #
24
+ # @option options [group] :channel
25
+ # Group to open.
26
+ # @see https://api.slack.com/methods/groups.close
27
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.close.md
28
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.close.json
29
+ def groups_close(options = {})
30
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
31
+ post('groups.close', options)
32
+ end
33
+
34
+ #
35
+ # Creates a private group.
36
+ #
37
+ # @option options [Object] :name
38
+ # Name of group to create
39
+ # @see https://api.slack.com/methods/groups.create
40
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.create.md
41
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.create.json
42
+ def groups_create(options = {})
43
+ throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
44
+ post('groups.create', options)
45
+ end
46
+
47
+ #
48
+ # Clones and archives a private group.
49
+ #
50
+ # @option options [group] :channel
51
+ # Group to clone and archive.
52
+ # @see https://api.slack.com/methods/groups.createChild
53
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.createChild.md
54
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.createChild.json
55
+ def groups_createChild(options = {})
56
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
57
+ post('groups.createChild', options)
58
+ end
59
+
60
+ #
61
+ # Fetches history of messages and events from a private group.
62
+ #
63
+ # @option options [group] :channel
64
+ # Group to fetch history for.
65
+ # @option options [timestamp] :latest
66
+ # Latest message timestamp to include in results.
67
+ # @option options [timestamp] :oldest
68
+ # Oldest message timestamp to include in results.
69
+ # @option options [Object] :count
70
+ # Number of messages to return, between 1 and 1000.
71
+ # @see https://api.slack.com/methods/groups.history
72
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.history.md
73
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.history.json
74
+ def groups_history(options = {})
75
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
76
+ post('groups.history', options)
77
+ end
78
+
79
+ #
80
+ # Invites a user to a private group.
81
+ #
82
+ # @option options [group] :channel
83
+ # Private group to invite user to.
84
+ # @option options [user] :user
85
+ # User to invite.
86
+ # @see https://api.slack.com/methods/groups.invite
87
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.invite.md
88
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.invite.json
89
+ def groups_invite(options = {})
90
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
91
+ throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
92
+ post('groups.invite', options)
93
+ end
94
+
95
+ #
96
+ # Removes a user from a private group.
97
+ #
98
+ # @option options [group] :channel
99
+ # Group to remove user from.
100
+ # @option options [user] :user
101
+ # User to remove from group.
102
+ # @see https://api.slack.com/methods/groups.kick
103
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.kick.md
104
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.kick.json
105
+ def groups_kick(options = {})
106
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
107
+ throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
108
+ post('groups.kick', options)
109
+ end
110
+
111
+ #
112
+ # Leaves a private group.
113
+ #
114
+ # @option options [group] :channel
115
+ # Group to leave
116
+ # @see https://api.slack.com/methods/groups.leave
117
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.leave.md
118
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.leave.json
119
+ def groups_leave(options = {})
120
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
121
+ post('groups.leave', options)
122
+ end
123
+
124
+ #
125
+ # Lists private groups that the calling user has access to.
126
+ #
127
+ # @option options [Object] :exclude_archived
128
+ # Don't return archived groups.
129
+ # @see https://api.slack.com/methods/groups.list
130
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.list.md
131
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.list.json
132
+ def groups_list(options = {})
133
+ post('groups.list', options)
134
+ end
135
+
136
+ #
137
+ # Sets the read cursor in a private group.
138
+ #
139
+ # @option options [group] :channel
140
+ # Group to set reading cursor in.
141
+ # @option options [timestamp] :ts
142
+ # Timestamp of the most recently seen message.
143
+ # @see https://api.slack.com/methods/groups.mark
144
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.mark.md
145
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.mark.json
146
+ def groups_mark(options = {})
147
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
148
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
149
+ post('groups.mark', options)
150
+ end
151
+
152
+ #
153
+ # Opens a private group.
154
+ #
155
+ # @option options [group] :channel
156
+ # Group to open.
157
+ # @see https://api.slack.com/methods/groups.open
158
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.open.md
159
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.open.json
160
+ def groups_open(options = {})
161
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
162
+ post('groups.open', options)
163
+ end
164
+
165
+ #
166
+ # Renames a private group.
167
+ #
168
+ # @option options [channel] :channel
169
+ # Group to rename
170
+ # @option options [Object] :name
171
+ # New name for group.
172
+ # @see https://api.slack.com/methods/groups.rename
173
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.rename.md
174
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.rename.json
175
+ def groups_rename(options = {})
176
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
177
+ throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
178
+ post('groups.rename', options)
179
+ end
180
+
181
+ #
182
+ # Sets the purpose for a private group.
183
+ #
184
+ # @option options [channel] :channel
185
+ # Private group to set the purpose of
186
+ # @option options [Object] :purpose
187
+ # The new purpose
188
+ # @see https://api.slack.com/methods/groups.setPurpose
189
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.setPurpose.md
190
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.setPurpose.json
191
+ def groups_setPurpose(options = {})
192
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
193
+ throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
194
+ post('groups.setPurpose', options)
195
+ end
196
+
197
+ #
198
+ # Sets the topic for a private group.
199
+ #
200
+ # @option options [channel] :channel
201
+ # Private group to set the topic of
202
+ # @option options [Object] :topic
203
+ # The new topic
204
+ # @see https://api.slack.com/methods/groups.setTopic
205
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.setTopic.md
206
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.setTopic.json
207
+ def groups_setTopic(options = {})
208
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
209
+ throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
210
+ post('groups.setTopic', options)
211
+ end
212
+
213
+ #
214
+ # Unarchives a private group.
215
+ #
216
+ # @option options [group] :channel
217
+ # Group to unarchive
218
+ # @see https://api.slack.com/methods/groups.unarchive
219
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.unarchive.md
220
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.unarchive.json
221
+ def groups_unarchive(options = {})
222
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
223
+ post('groups.unarchive', options)
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
229
+ end
@@ -0,0 +1,82 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Im
8
+ #
9
+ # Close a direct message channel.
10
+ #
11
+ # @option options [im] :channel
12
+ # Direct message channel to close.
13
+ # @see https://api.slack.com/methods/im.close
14
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.close.md
15
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.close.json
16
+ def im_close(options = {})
17
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
18
+ post('im.close', options)
19
+ end
20
+
21
+ #
22
+ # Fetches history of messages and events from direct message channel.
23
+ #
24
+ # @option options [im] :channel
25
+ # Direct message channel to fetch history for.
26
+ # @option options [timestamp] :latest
27
+ # Latest message timestamp to include in results.
28
+ # @option options [timestamp] :oldest
29
+ # Oldest message timestamp to include in results.
30
+ # @option options [Object] :count
31
+ # Number of messages to return, between 1 and 1000.
32
+ # @see https://api.slack.com/methods/im.history
33
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.history.md
34
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.history.json
35
+ def im_history(options = {})
36
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
37
+ post('im.history', options)
38
+ end
39
+
40
+ #
41
+ # Lists direct message channels for the calling user.
42
+ #
43
+ # @see https://api.slack.com/methods/im.list
44
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.list.md
45
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.list.json
46
+ def im_list(options = {})
47
+ post('im.list', options)
48
+ end
49
+
50
+ #
51
+ # Sets the read cursor in a direct message channel.
52
+ #
53
+ # @option options [im] :channel
54
+ # Direct message channel to set reading cursor in.
55
+ # @option options [timestamp] :ts
56
+ # Timestamp of the most recently seen message.
57
+ # @see https://api.slack.com/methods/im.mark
58
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.mark.md
59
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.mark.json
60
+ def im_mark(options = {})
61
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
62
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
63
+ post('im.mark', options)
64
+ end
65
+
66
+ #
67
+ # Opens a direct message channel.
68
+ #
69
+ # @option options [user] :user
70
+ # User to open a direct message channel with.
71
+ # @see https://api.slack.com/methods/im.open
72
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.open.md
73
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.open.json
74
+ def im_open(options = {})
75
+ throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
76
+ post('im.open', options)
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end