slack-ruby-client-bhe 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +17 -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 +78 -0
  7. data/.travis.yml +26 -0
  8. data/CHANGELOG.md +79 -0
  9. data/CONTRIBUTING.md +157 -0
  10. data/Gemfile +5 -0
  11. data/LICENSE.md +22 -0
  12. data/README.md +385 -0
  13. data/RELEASING.md +69 -0
  14. data/Rakefile +19 -0
  15. data/UPGRADING.md +26 -0
  16. data/bin/commands.rb +21 -0
  17. data/bin/commands/api.rb +14 -0
  18. data/bin/commands/auth.rb +12 -0
  19. data/bin/commands/channels.rb +149 -0
  20. data/bin/commands/chat.rb +47 -0
  21. data/bin/commands/dnd.rb +47 -0
  22. data/bin/commands/emoji.rb +12 -0
  23. data/bin/commands/files.rb +72 -0
  24. data/bin/commands/groups.rb +167 -0
  25. data/bin/commands/im.rb +53 -0
  26. data/bin/commands/mpim.rb +53 -0
  27. data/bin/commands/oauth.rb +16 -0
  28. data/bin/commands/pins.rb +37 -0
  29. data/bin/commands/reactions.rb +53 -0
  30. data/bin/commands/rtm.rb +15 -0
  31. data/bin/commands/search.rb +40 -0
  32. data/bin/commands/stars.rb +37 -0
  33. data/bin/commands/team.rb +32 -0
  34. data/bin/commands/usergroups.rb +73 -0
  35. data/bin/commands/users.rb +57 -0
  36. data/bin/slack +50 -0
  37. data/examples/hi_real_time/Gemfile +5 -0
  38. data/examples/hi_real_time/hi.gif +0 -0
  39. data/examples/hi_real_time/hi.rb +32 -0
  40. data/examples/hi_real_time_and_web/Gemfile +5 -0
  41. data/examples/hi_real_time_and_web/hi.gif +0 -0
  42. data/examples/hi_real_time_and_web/hi.rb +24 -0
  43. data/examples/hi_real_time_async/Gemfile +5 -0
  44. data/examples/hi_real_time_async/hi.rb +29 -0
  45. data/examples/hi_web/Gemfile +3 -0
  46. data/examples/hi_web/hi.gif +0 -0
  47. data/examples/hi_web/hi.rb +12 -0
  48. data/examples/new_ticket/Gemfile +3 -0
  49. data/examples/new_ticket/new_ticket.rb +25 -0
  50. data/lib/slack-ruby-client.rb +29 -0
  51. data/lib/slack.rb +1 -0
  52. data/lib/slack/config.rb +21 -0
  53. data/lib/slack/messages/formatting.rb +30 -0
  54. data/lib/slack/real_time/api/message.rb +20 -0
  55. data/lib/slack/real_time/api/message_id.rb +14 -0
  56. data/lib/slack/real_time/api/ping.rb +16 -0
  57. data/lib/slack/real_time/api/typing.rb +17 -0
  58. data/lib/slack/real_time/client.rb +152 -0
  59. data/lib/slack/real_time/concurrency.rb +8 -0
  60. data/lib/slack/real_time/concurrency/celluloid.rb +93 -0
  61. data/lib/slack/real_time/concurrency/eventmachine.rb +39 -0
  62. data/lib/slack/real_time/config.rb +55 -0
  63. data/lib/slack/real_time/socket.rb +81 -0
  64. data/lib/slack/version.rb +3 -0
  65. data/lib/slack/web/api/endpoints.rb +53 -0
  66. data/lib/slack/web/api/endpoints/api.rb +24 -0
  67. data/lib/slack/web/api/endpoints/auth.rb +20 -0
  68. data/lib/slack/web/api/endpoints/channels.rb +220 -0
  69. data/lib/slack/web/api/endpoints/chat.rb +91 -0
  70. data/lib/slack/web/api/endpoints/dnd.rb +64 -0
  71. data/lib/slack/web/api/endpoints/emoji.rb +20 -0
  72. data/lib/slack/web/api/endpoints/files.rb +108 -0
  73. data/lib/slack/web/api/endpoints/groups.rb +247 -0
  74. data/lib/slack/web/api/endpoints/im.rb +85 -0
  75. data/lib/slack/web/api/endpoints/mpim.rb +84 -0
  76. data/lib/slack/web/api/endpoints/oauth.rb +32 -0
  77. data/lib/slack/web/api/endpoints/pins.rb +64 -0
  78. data/lib/slack/web/api/endpoints/presence.rb +23 -0
  79. data/lib/slack/web/api/endpoints/reactions.rb +89 -0
  80. data/lib/slack/web/api/endpoints/rtm.rb +27 -0
  81. data/lib/slack/web/api/endpoints/search.rb +65 -0
  82. data/lib/slack/web/api/endpoints/stars.rb +61 -0
  83. data/lib/slack/web/api/endpoints/team.rb +47 -0
  84. data/lib/slack/web/api/endpoints/usergroups.rb +113 -0
  85. data/lib/slack/web/api/endpoints/users.rb +73 -0
  86. data/lib/slack/web/api/error.rb +14 -0
  87. data/lib/slack/web/api/mixins.rb +3 -0
  88. data/lib/slack/web/api/mixins/channels.id.json +20 -0
  89. data/lib/slack/web/api/mixins/channels.id.rb +26 -0
  90. data/lib/slack/web/api/mixins/groups.id.json +20 -0
  91. data/lib/slack/web/api/mixins/groups.id.rb +26 -0
  92. data/lib/slack/web/api/mixins/users.id.json +20 -0
  93. data/lib/slack/web/api/mixins/users.id.rb +26 -0
  94. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +13 -0
  95. data/lib/slack/web/api/patches/chat.2.attachments-json.patch +17 -0
  96. data/lib/slack/web/api/schema/group.json +14 -0
  97. data/lib/slack/web/api/schema/method.json +45 -0
  98. data/lib/slack/web/api/tasks/generate.rake +61 -0
  99. data/lib/slack/web/api/templates/command.erb +34 -0
  100. data/lib/slack/web/api/templates/commands.erb +5 -0
  101. data/lib/slack/web/api/templates/endpoints.erb +21 -0
  102. data/lib/slack/web/api/templates/method.erb +49 -0
  103. data/lib/slack/web/client.rb +28 -0
  104. data/lib/slack/web/config.rb +41 -0
  105. data/lib/slack/web/faraday/connection.rb +29 -0
  106. data/lib/slack/web/faraday/request.rb +39 -0
  107. data/lib/slack/web/faraday/response/raise_error.rb +15 -0
  108. data/lib/slack_ruby_client.rb +1 -0
  109. data/screenshots/register-bot.png +0 -0
  110. data/slack-ruby-client.gemspec +31 -0
  111. data/slack.png +0 -0
  112. data/spec/fixtures/slack/web/429_error.yml +83 -0
  113. data/spec/fixtures/slack/web/auth_test_error.yml +48 -0
  114. data/spec/fixtures/slack/web/auth_test_success.yml +57 -0
  115. data/spec/fixtures/slack/web/channels_info.yml +46 -0
  116. data/spec/fixtures/slack/web/groups_info.yml +43 -0
  117. data/spec/fixtures/slack/web/rtm_start.yml +73 -0
  118. data/spec/fixtures/slack/web/users_info.yml +130 -0
  119. data/spec/fixtures/slack/web/users_list.yml +72 -0
  120. data/spec/integration/integration_spec.rb +107 -0
  121. data/spec/slack/config_spec.rb +14 -0
  122. data/spec/slack/messages/formatting_spec.rb +43 -0
  123. data/spec/slack/real_time/api/message_spec.rb +15 -0
  124. data/spec/slack/real_time/api/ping_spec.rb +15 -0
  125. data/spec/slack/real_time/api/typing_spec.rb +15 -0
  126. data/spec/slack/real_time/client_spec.rb +198 -0
  127. data/spec/slack/real_time/concurrency/celluloid_spec.rb +58 -0
  128. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +49 -0
  129. data/spec/slack/slack_spec.rb +58 -0
  130. data/spec/slack/version_spec.rb +7 -0
  131. data/spec/slack/web/api/endpoints/auth_spec.rb +20 -0
  132. data/spec/slack/web/api/endpoints/channels_spec.rb +11 -0
  133. data/spec/slack/web/api/endpoints/chat_spec.rb +33 -0
  134. data/spec/slack/web/api/endpoints/groups_spec.rb +11 -0
  135. data/spec/slack/web/api/endpoints/users_spec.rb +17 -0
  136. data/spec/slack/web/api/error_spec.rb +14 -0
  137. data/spec/slack/web/api/mixins/channels_spec.rb +31 -0
  138. data/spec/slack/web/api/mixins/groups_spec.rb +31 -0
  139. data/spec/slack/web/api/mixins/users_spec.rb +31 -0
  140. data/spec/slack/web/client_spec.rb +134 -0
  141. data/spec/spec_helper.rb +14 -0
  142. data/spec/support/queue_with_timeout.rb +34 -0
  143. data/spec/support/real_time/concurrency/mock.rb +31 -0
  144. data/spec/support/real_time/connected_client.rb +16 -0
  145. data/spec/support/token.rb +10 -0
  146. data/spec/support/vcr.rb +8 -0
  147. metadata +392 -0
@@ -0,0 +1,20 @@
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
+ # This method lists the custom emoji for a team.
10
+ #
11
+ # @see https://api.slack.com/methods/emoji.list
12
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/emoji.list.json
13
+ def emoji_list(options = {})
14
+ post('emoji.list', options)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,108 @@
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
+ # Edit an existing comment on a file. Only the user who created a comment may make edits. Teams may configure a limited time window during which file comment edits are allowed.
10
+ #
11
+ # @option options [file] :file
12
+ # File containing the comment to edit.
13
+ # @option options [Object] :id
14
+ # The comment to edit.
15
+ # @option options [Object] :comment
16
+ # Text of the comment to edit.
17
+ # @see https://api.slack.com/methods/files.comments
18
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.comments.json
19
+ def files_comments(options = {})
20
+ throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
21
+ throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
22
+ throw ArgumentError.new('Required arguments :comment missing') if options[:comment].nil?
23
+ post('files.comments', options)
24
+ end
25
+
26
+ #
27
+ # This method deletes a file from your team.
28
+ #
29
+ # @option options [file] :file
30
+ # ID of file to delete.
31
+ # @see https://api.slack.com/methods/files.delete
32
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.delete.json
33
+ def files_delete(options = {})
34
+ throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
35
+ post('files.delete', options)
36
+ end
37
+
38
+ #
39
+ # This method returns information about a file in your team.
40
+ #
41
+ # @option options [file] :file
42
+ # File to fetch info for.
43
+ # @see https://api.slack.com/methods/files.info
44
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.info.json
45
+ def files_info(options = {})
46
+ throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
47
+ post('files.info', options)
48
+ end
49
+
50
+ #
51
+ # This method returns a list of files within the team. It can be filtered and sliced in various ways.
52
+ #
53
+ # @option options [user] :user
54
+ # Filter files created by a single user.
55
+ # @option options [Object] :ts_from
56
+ # Filter files created after this timestamp (inclusive).
57
+ # @option options [Object] :ts_to
58
+ # Filter files created before this timestamp (inclusive).
59
+ # @option options [Object] :types
60
+ # Filter files by type:
61
+ #
62
+ # all - All files
63
+ # posts - Posts
64
+ # snippets - Snippets
65
+ # images - Image files
66
+ # gdocs - Google docs
67
+ # zips - Zip files
68
+ # pdfs - PDF files
69
+ #
70
+ #
71
+ # You can pass multiple values in the types argument, like types=posts,snippets.The default value is all, which does not filter the list.
72
+ # .
73
+ # @see https://api.slack.com/methods/files.list
74
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.list.json
75
+ def files_list(options = {})
76
+ options = options.merge(user: users_id(options)['user']['id']) if options[:user]
77
+ post('files.list', options)
78
+ end
79
+
80
+ #
81
+ # This method allows you to create or upload an existing file.
82
+ #
83
+ # @option options [file] :file
84
+ # File contents via multipart/form-data.
85
+ # @option options [Object] :content
86
+ # File contents via a POST var.
87
+ # @option options [Object] :filetype
88
+ # Slack-internal file type identifier.
89
+ # @option options [Object] :filename
90
+ # Filename of file.
91
+ # @option options [Object] :title
92
+ # Title of file.
93
+ # @option options [Object] :initial_comment
94
+ # Initial comment to add to file.
95
+ # @option options [Object] :channels
96
+ # Comma-separated list of channel names or IDs where the file will be shared.
97
+ # @see https://api.slack.com/methods/files.upload
98
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.upload.json
99
+ def files_upload(options = {})
100
+ throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
101
+ throw ArgumentError.new('Required arguments :filename missing') if options[:filename].nil?
102
+ post('files.upload', options)
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,247 @@
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
+ # This method archives a private channel.
10
+ #
11
+ # @option options [group] :channel
12
+ # Private channel to archive.
13
+ # @see https://api.slack.com/methods/groups.archive
14
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.archive.json
15
+ def groups_archive(options = {})
16
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
17
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
18
+ post('groups.archive', options)
19
+ end
20
+
21
+ #
22
+ # This method closes a private channel.
23
+ #
24
+ # @option options [group] :channel
25
+ # Private channel to close.
26
+ # @see https://api.slack.com/methods/groups.close
27
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.close.json
28
+ def groups_close(options = {})
29
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
30
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
31
+ post('groups.close', options)
32
+ end
33
+
34
+ #
35
+ # This method creates a private channel.
36
+ #
37
+ # @option options [Object] :name
38
+ # Name of private channel to create.
39
+ # @see https://api.slack.com/methods/groups.create
40
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.create.json
41
+ def groups_create(options = {})
42
+ throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
43
+ post('groups.create', options)
44
+ end
45
+
46
+ #
47
+ # This method takes an existing private channel and performs the following steps:
48
+ #
49
+ # @option options [group] :channel
50
+ # Private channel to clone and archive.
51
+ # @see https://api.slack.com/methods/groups.createChild
52
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.createChild.json
53
+ def groups_createChild(options = {})
54
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
55
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
56
+ post('groups.createChild', options)
57
+ end
58
+
59
+ #
60
+ # This method returns a portion of messages/events from the specified private channel.
61
+ # To read the entire history for a private channel, call the method with no latest or
62
+ # oldest arguments, and then continue paging using the instructions below.
63
+ #
64
+ # @option options [group] :channel
65
+ # Private channel to fetch history for.
66
+ # @option options [timestamp] :latest
67
+ # End of time range of messages to include in results.
68
+ # @option options [timestamp] :oldest
69
+ # Start of time range of messages to include in results.
70
+ # @option options [Object] :inclusive
71
+ # Include messages with latest or oldest timestamp in results.
72
+ # @option options [Object] :unreads
73
+ # Include unread_count_display in the output?.
74
+ # @see https://api.slack.com/methods/groups.history
75
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.history.json
76
+ def groups_history(options = {})
77
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
78
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
79
+ post('groups.history', options)
80
+ end
81
+
82
+ #
83
+ # This method returns information about a private channel.
84
+ #
85
+ # @option options [group] :channel
86
+ # Private channel to get info on.
87
+ # @see https://api.slack.com/methods/groups.info
88
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.info.json
89
+ def groups_info(options = {})
90
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
91
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
92
+ post('groups.info', options)
93
+ end
94
+
95
+ #
96
+ # This method is used to invite a user to a private channel. The calling user must be a member of the private channel.
97
+ #
98
+ # @option options [group] :channel
99
+ # Private channel to invite user to.
100
+ # @option options [user] :user
101
+ # User to invite.
102
+ # @see https://api.slack.com/methods/groups.invite
103
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.invite.json
104
+ def groups_invite(options = {})
105
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
106
+ throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
107
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
108
+ options = options.merge(user: users_id(options)['user']['id']) if options[:user]
109
+ post('groups.invite', options)
110
+ end
111
+
112
+ #
113
+ # This method allows a user to remove another member from a private channel.
114
+ #
115
+ # @option options [group] :channel
116
+ # Private channel to remove user from.
117
+ # @option options [user] :user
118
+ # User to remove from private channel.
119
+ # @see https://api.slack.com/methods/groups.kick
120
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.kick.json
121
+ def groups_kick(options = {})
122
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
123
+ throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
124
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
125
+ options = options.merge(user: users_id(options)['user']['id']) if options[:user]
126
+ post('groups.kick', options)
127
+ end
128
+
129
+ #
130
+ # This method is used to leave a private channel.
131
+ #
132
+ # @option options [group] :channel
133
+ # Private channel to leave.
134
+ # @see https://api.slack.com/methods/groups.leave
135
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.leave.json
136
+ def groups_leave(options = {})
137
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
138
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
139
+ post('groups.leave', options)
140
+ end
141
+
142
+ #
143
+ # This method returns a list of private channels in the team that the caller is in and archived groups that the caller was in.
144
+ # The list of (non-deactivated) members in each private channel is also returned.
145
+ #
146
+ # @option options [Object] :exclude_archived
147
+ # Don't return archived private channels.
148
+ # @see https://api.slack.com/methods/groups.list
149
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.list.json
150
+ def groups_list(options = {})
151
+ post('groups.list', options)
152
+ end
153
+
154
+ #
155
+ # This method moves the read cursor in a private channel.
156
+ #
157
+ # @option options [group] :channel
158
+ # Private channel to set reading cursor in.
159
+ # @option options [timestamp] :ts
160
+ # Timestamp of the most recently seen message.
161
+ # @see https://api.slack.com/methods/groups.mark
162
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.mark.json
163
+ def groups_mark(options = {})
164
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
165
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
166
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
167
+ post('groups.mark', options)
168
+ end
169
+
170
+ #
171
+ # This method opens a private channel.
172
+ #
173
+ # @option options [group] :channel
174
+ # Private channel to open.
175
+ # @see https://api.slack.com/methods/groups.open
176
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.open.json
177
+ def groups_open(options = {})
178
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
179
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
180
+ post('groups.open', options)
181
+ end
182
+
183
+ #
184
+ # This method renames a private channel.
185
+ #
186
+ # @option options [group] :channel
187
+ # Private channel to rename.
188
+ # @option options [Object] :name
189
+ # New name for private channel.
190
+ # @see https://api.slack.com/methods/groups.rename
191
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.rename.json
192
+ def groups_rename(options = {})
193
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
194
+ throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
195
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
196
+ post('groups.rename', options)
197
+ end
198
+
199
+ #
200
+ # This method is used to change the purpose of a private channel. The calling user must be a member of the private channel.
201
+ #
202
+ # @option options [group] :channel
203
+ # Private channel to set the purpose of.
204
+ # @option options [Object] :purpose
205
+ # The new purpose.
206
+ # @see https://api.slack.com/methods/groups.setPurpose
207
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.setPurpose.json
208
+ def groups_setPurpose(options = {})
209
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
210
+ throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
211
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
212
+ post('groups.setPurpose', options)
213
+ end
214
+
215
+ #
216
+ # This method is used to change the topic of a private channel. The calling user must be a member of the private channel.
217
+ #
218
+ # @option options [group] :channel
219
+ # Private channel to set the topic of.
220
+ # @option options [Object] :topic
221
+ # The new topic.
222
+ # @see https://api.slack.com/methods/groups.setTopic
223
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.setTopic.json
224
+ def groups_setTopic(options = {})
225
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
226
+ throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
227
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
228
+ post('groups.setTopic', options)
229
+ end
230
+
231
+ #
232
+ # This method unarchives a private channel.
233
+ #
234
+ # @option options [group] :channel
235
+ # Private channel to unarchive.
236
+ # @see https://api.slack.com/methods/groups.unarchive
237
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.unarchive.json
238
+ def groups_unarchive(options = {})
239
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
240
+ options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
241
+ post('groups.unarchive', options)
242
+ end
243
+ end
244
+ end
245
+ end
246
+ end
247
+ end
@@ -0,0 +1,85 @@
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
+ # This method closes 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/dblock/slack-api-ref/blob/master/methods/im.close.json
15
+ def im_close(options = {})
16
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
17
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
18
+ post('im.close', options)
19
+ end
20
+
21
+ #
22
+ # This method returns a portion of messages/events from the specified direct message channel.
23
+ # To read the entire history for a direct message channel, call the method with no latest or
24
+ # oldest arguments, and then continue paging using the instructions below.
25
+ #
26
+ # @option options [im] :channel
27
+ # Direct message channel to fetch history for.
28
+ # @option options [timestamp] :latest
29
+ # End of time range of messages to include in results.
30
+ # @option options [timestamp] :oldest
31
+ # Start of time range of messages to include in results.
32
+ # @option options [Object] :inclusive
33
+ # Include messages with latest or oldest timestamp in results.
34
+ # @option options [Object] :unreads
35
+ # Include unread_count_display in the output?.
36
+ # @see https://api.slack.com/methods/im.history
37
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.history.json
38
+ def im_history(options = {})
39
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
40
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
41
+ post('im.history', options)
42
+ end
43
+
44
+ #
45
+ # This method returns a list of all im channels that the user has.
46
+ #
47
+ # @see https://api.slack.com/methods/im.list
48
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.list.json
49
+ def im_list(options = {})
50
+ post('im.list', options)
51
+ end
52
+
53
+ #
54
+ # This method moves the read cursor in a direct message channel.
55
+ #
56
+ # @option options [im] :channel
57
+ # Direct message channel to set reading cursor in.
58
+ # @option options [timestamp] :ts
59
+ # Timestamp of the most recently seen message.
60
+ # @see https://api.slack.com/methods/im.mark
61
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.mark.json
62
+ def im_mark(options = {})
63
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
64
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
65
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
66
+ post('im.mark', options)
67
+ end
68
+
69
+ #
70
+ # This method opens a direct message channel with another member of your Slack team.
71
+ #
72
+ # @option options [user] :user
73
+ # User to open a direct message channel with.
74
+ # @see https://api.slack.com/methods/im.open
75
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.open.json
76
+ def im_open(options = {})
77
+ throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
78
+ options = options.merge(user: users_id(options)['user']['id']) if options[:user]
79
+ post('im.open', options)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end