slack-ruby-client 0.4.0 → 0.5.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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -1
  3. data/.rubocop_todo.yml +23 -6
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG.md +11 -0
  6. data/Gemfile +2 -0
  7. data/README.md +89 -1
  8. data/RELEASING.md +3 -1
  9. data/UPGRADING.md +26 -0
  10. data/bin/commands.rb +20 -0
  11. data/bin/commands/api.rb +14 -0
  12. data/bin/commands/auth.rb +12 -0
  13. data/bin/commands/channels.rb +140 -0
  14. data/bin/commands/chat.rb +47 -0
  15. data/bin/commands/emoji.rb +12 -0
  16. data/bin/commands/files.rb +61 -0
  17. data/bin/commands/groups.rb +158 -0
  18. data/bin/commands/im.rb +53 -0
  19. data/bin/commands/mpim.rb +53 -0
  20. data/bin/commands/oauth.rb +16 -0
  21. data/bin/commands/pins.rb +37 -0
  22. data/bin/commands/reactions.rb +53 -0
  23. data/bin/commands/rtm.rb +15 -0
  24. data/bin/commands/search.rb +40 -0
  25. data/bin/commands/stars.rb +37 -0
  26. data/bin/commands/team.rb +32 -0
  27. data/bin/commands/usergroups.rb +73 -0
  28. data/bin/commands/users.rb +48 -0
  29. data/bin/slack +50 -0
  30. data/examples/hi_real_time/Gemfile +2 -0
  31. data/examples/hi_real_time_and_web/Gemfile +2 -0
  32. data/examples/hi_real_time_async/Gemfile +5 -0
  33. data/examples/hi_real_time_async/hi.rb +29 -0
  34. data/lib/slack-ruby-client.rb +2 -2
  35. data/lib/slack/real_time/client.rb +72 -30
  36. data/lib/slack/real_time/concurrency.rb +8 -0
  37. data/lib/slack/real_time/concurrency/celluloid.rb +92 -0
  38. data/lib/slack/real_time/concurrency/eventmachine.rb +39 -0
  39. data/lib/slack/real_time/config.rb +23 -1
  40. data/lib/slack/real_time/socket.rb +50 -12
  41. data/lib/slack/version.rb +1 -1
  42. data/lib/slack/web/api/endpoints.rb +2 -0
  43. data/lib/slack/web/api/endpoints/groups.rb +1 -1
  44. data/lib/slack/web/api/endpoints/team.rb +1 -1
  45. data/lib/slack/web/api/endpoints/usergroups.rb +113 -0
  46. data/lib/slack/web/api/error.rb +6 -0
  47. data/lib/slack/web/api/schema/group.json +14 -0
  48. data/lib/slack/web/api/tasks/generate.rake +19 -3
  49. data/lib/slack/web/api/templates/command.erb +34 -0
  50. data/lib/slack/web/api/templates/commands.erb +5 -0
  51. data/lib/slack/web/config.rb +2 -0
  52. data/lib/slack/web/faraday/connection.rb +3 -2
  53. data/lib/slack/web/faraday/response/raise_error.rb +2 -1
  54. data/slack-ruby-client.gemspec +4 -2
  55. data/spec/fixtures/slack/web/429_error.yml +83 -0
  56. data/spec/fixtures/slack/web/rtm_start.yml +1 -1
  57. data/spec/fixtures/slack/web/users_list.yml +72 -0
  58. data/spec/integration/integration_spec.rb +88 -0
  59. data/spec/slack/real_time/client_spec.rb +8 -5
  60. data/spec/slack/real_time/concurrency/celluloid_spec.rb +58 -0
  61. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +49 -0
  62. data/spec/slack/slack_spec.rb +52 -0
  63. data/spec/slack/web/api/endpoints/auth_spec.rb +6 -1
  64. data/spec/slack/web/api/endpoints/users_spec.rb +13 -0
  65. data/spec/slack/web/api/error_spec.rb +14 -0
  66. data/spec/slack/web/client_spec.rb +16 -0
  67. data/spec/support/real_time/concurrency/mock.rb +31 -0
  68. data/spec/support/real_time/connected_client.rb +5 -2
  69. metadata +55 -8
  70. data/spec/slack/real_time/socket_spec.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdfb697bdb471743bc8c46c29e685af650570952
4
- data.tar.gz: 0e0b770c177930831491961f36097cf6fc1c1c17
3
+ metadata.gz: 0d6e26bc5f3e7e53c67ece14f51482ba24bfbbd1
4
+ data.tar.gz: c83f574cf4041f1507c3ffdf9a0716669306ead9
5
5
  SHA512:
6
- metadata.gz: 1e79611aef6f955e67f2a250a7c0a48080634ba61066375cbca7882897b41e5f0043f60d5bd878dddaa67ca0b8cc66bde5a48cb4edc9bb82c567b5e216aa8c59
7
- data.tar.gz: 38d866a7132a1981866bb055a24ef8ba6ee8661007b46662dc97e669f335850fa69c01bdd57dd84c2caa0278afff6e70a7eb669e20d2307cff83bef5f836aa9b
6
+ metadata.gz: 6753176ae587da7add086f67a6d51f9451e4160283ac369bef881743c1930c0b571b048d6c25bc54c8d2347ddf42f32024a46ed1cc93207fee346b55a7dfe8d5
7
+ data.tar.gz: a1e45d53c9e0e1bb04369f4ad3f94fd7f061d92a0d8f2974fa89861c75a001cbfb7ea5cac63812ea4cab4fe3c7e9e411408731047d1d2be3f259b744b2e24153
@@ -1,7 +1,6 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - vendor/**/*
4
- - bin/**/*
5
4
  - lib/slack/web/api/slack-api-ref/**/*
6
5
 
7
6
  inherit_from: .rubocop_todo.yml
@@ -1,31 +1,43 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2015-11-08 16:15:14 -0500 using RuboCop version 0.35.0.
3
+ # on 2015-12-06 15:38:34 -0500 using RuboCop version 0.35.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 3
10
+ Lint/HandleExceptions:
11
+ Exclude:
12
+ - 'lib/slack/real_time/concurrency/celluloid.rb'
13
+ - 'spec/slack/real_time/concurrency/celluloid_spec.rb'
14
+ - 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
15
+
16
+ # Offense count: 2
10
17
  Metrics/AbcSize:
11
- Max: 19
18
+ Max: 20
12
19
 
13
- # Offense count: 178
20
+ # Offense count: 1
21
+ # Configuration parameters: CountComments.
22
+ Metrics/ClassLength:
23
+ Max: 112
24
+
25
+ # Offense count: 324
14
26
  # Configuration parameters: AllowURI, URISchemes.
15
27
  Metrics/LineLength:
16
- Max: 174
28
+ Max: 288
17
29
 
18
30
  # Offense count: 3
19
31
  # Configuration parameters: CountComments.
20
32
  Metrics/MethodLength:
21
- Max: 19
33
+ Max: 15
22
34
 
23
35
  # Offense count: 1
24
36
  Style/AsciiComments:
25
37
  Exclude:
26
38
  - 'lib/slack/web/api/endpoints/team.rb'
27
39
 
28
- # Offense count: 36
40
+ # Offense count: 41
29
41
  # Configuration parameters: Exclude.
30
42
  Style/Documentation:
31
43
  Enabled: false
@@ -36,6 +48,11 @@ Style/FileName:
36
48
  Exclude:
37
49
  - 'lib/slack-ruby-client.rb'
38
50
 
51
+ # Offense count: 74
52
+ # Configuration parameters: AllowedVariables.
53
+ Style/GlobalVars:
54
+ Enabled: false
55
+
39
56
  # Offense count: 11
40
57
  # Configuration parameters: EnforcedStyle, SupportedStyles.
41
58
  Style/MethodName:
@@ -15,3 +15,6 @@ matrix:
15
15
  git:
16
16
  submodules: false
17
17
 
18
+ env:
19
+ - CONCURRENCY=celluloid-io
20
+ - CONCURRENCY=faye-websocket
@@ -1,3 +1,14 @@
1
+ ### 0.5.0 (12/7/2015)
2
+
3
+ * Added `usergroups_create`, `usergroups_disable`, `usergroups_enable`, `usergroups_list`, `usergroups_update` and `usergroups_users` to Web API - [@dblock](https://github.com/dblock).
4
+ * Added command-line `slack` client - [@dblock](https://github.com/dblock).
5
+ * [#5](https://github.com/dblock/slack-ruby-client/issues/5): Added Celluloid support - [@mikz](https://github.com/mikz), [@dblock](https://github.com/dblock).
6
+ * [#34](https://github.com/dblock/slack-ruby-client/pull/34): Added `Slack::RealTime::Client#start_async` - [@mikz](https://github.com/mikz), [@dblock](https://github.com/dblock).
7
+ * `Slack::RealTime::Client` supports `:open` and `:close` callbacks - [@dblock](https://github.com/dblock).
8
+ * [#32](https://github.com/dblock/slack-ruby-client/issues/32): Fix: `on_complete: undefined method [] for nil:NilClass` when responding to Slack 400-500 errors - [@dblock](https://github.com/dblock).
9
+ * [#22](https://github.com/dblock/slack-ruby-client/issues/22): Added `Slack::Web::Api::Error#response` - [@dblock](https://github.com/dblock).
10
+ * Added `logger` to `Slack::Web::Client` configuration that logs HTTP requests - [@dblock](https://github.com/dblock).
11
+
1
12
  ### 0.4.0 (11/8/2015)
2
13
 
3
14
  * Added `team_integrationLogs` to Web API - [@dblock](https://github.com/dblock).
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem ENV['CONCURRENCY'], require: false if ENV.key?('CONCURRENCY')
data/README.md CHANGED
@@ -3,13 +3,18 @@ Slack Ruby Client
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/slack-ruby-client.svg)](http://badge.fury.io/rb/slack-ruby-client)
5
5
  [![Build Status](https://travis-ci.org/dblock/slack-ruby-client.svg?branch=master)](https://travis-ci.org/dblock/slack-ruby-client)
6
+ [![Code Climate](https://codeclimate.com/github/dblock/slack-ruby-client/badges/gpa.svg)](https://codeclimate.com/github/dblock/slack-ruby-client)
6
7
 
7
- A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messaging](https://api.slack.com/rtm) APIs.
8
+ A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messaging](https://api.slack.com/rtm) APIs. Comes with a handy command-line client, too.
8
9
 
9
10
  Writing a bot? Try [slack-ruby-bot](https://github.com/dblock/slack-ruby-bot) instead.
10
11
 
11
12
  ![](slack.png)
12
13
 
14
+ ## Stable Release
15
+
16
+ You're reading the documentation for [stable release, v0.5.0](https://github.com/dblock/slack-ruby-client/blob/v0.5.0/README.md). See [UPGRADING](UPGRADING.md) when upgrading from an older version.
17
+
13
18
  ## Installation
14
19
 
15
20
  Add to Gemfile.
@@ -18,6 +23,13 @@ Add to Gemfile.
18
23
  gem 'slack-ruby-client'
19
24
  ```
20
25
 
26
+ If you're going to be using the RealTime client, add either `eventmachine` and `faye-websocket` or `celluloid-io`. See below for more information about concurrency.
27
+
28
+ ```
29
+ gem 'eventmachine'
30
+ gem 'faye-websocket'
31
+ ```
32
+
21
33
  Run `bundle install`.
22
34
 
23
35
  ## Usage
@@ -80,6 +92,7 @@ proxy | Optional HTTP proxy.
80
92
  ca_path | Optional SSL certificates path.
81
93
  ca_file | Optional SSL certificates file.
82
94
  endpoint | Slack endpoint, default is _https://slack.com/api_.
95
+ logger | Optional `Logger` instance that logs HTTP requests.
83
96
 
84
97
  ### RealTime Client
85
98
 
@@ -178,6 +191,81 @@ See a fullly working example in [examples/hi_real_time_and_web](examples/hi_real
178
191
 
179
192
  ![](examples/hi_real_time_and_web/hi.gif)
180
193
 
194
+ #### Concurrency
195
+
196
+ `Slack::RealTime::Client` needs help from a concurrency library and supports [Faye::WebSocket](https://github.com/faye/faye-websocket-ruby) with [Eventmachine](https://github.com/eventmachine/eventmachine) and [Celluloid](https://github.com/celluloid/celluloid). It will auto-detect one or the other depending on the gems in your Gemfile, but you can also set concurrency explicitly.
197
+
198
+ ```ruby
199
+ Slack::RealTime.configure do |config|
200
+ config.concurrency = Slack::RealTime::Concurrency::Eventmachine
201
+ end
202
+ ```
203
+
204
+ Use `client.start_async` instead of `client.start!` if you don't want the library to control the event run loop, such as when integrating into other applications that already use Eventmachine or Celluloid. A good example of such application is [slack-bot-server](https://github.com/dblock/slack-bot-server).
205
+
206
+ ```ruby
207
+ client = Slack::RealTime::Client.new
208
+
209
+ EM.run do
210
+ client.start_async
211
+ end
212
+ ```
213
+
214
+ See a fullly working example in [examples/hi_real_time_async](examples/hi_real_time_async/hi.rb).
215
+
216
+ ##### Faye::Websocket with Eventmachine
217
+
218
+ Add the following to your Gemfile.
219
+
220
+ ```
221
+ gem 'faye-websocket'
222
+ ```
223
+
224
+ ##### Celluloid
225
+
226
+ Add the following to your Gemfile.
227
+
228
+ ```
229
+ gem 'celluloid-io'
230
+ ```
231
+
232
+ ### Command-Line Client
233
+
234
+ The slack command-line client returns JSON data from the Slack API.
235
+
236
+ #### Authenticate with Slack
237
+
238
+ ```
239
+ $ slack --slack-api-token=[token] auth test
240
+ {"ok":true,"url":"...","team":"...","user":"...","team_id":"...","user_id":"..."}
241
+ ```
242
+
243
+ #### Send a Message
244
+
245
+ ```
246
+ export SLACK_API_TOKEN=...
247
+ $ slack chat postMessage --text="hello world" --channel="#general"
248
+ {"ok":true,"channel":"...","ts":"...","message":{"text":"hello world","username":"bot","type":"message","subtype":"bot_message","ts":"..."}}
249
+ ```
250
+
251
+ #### List Users
252
+
253
+ Combine with [jq](http://stedolan.github.io/jq), a command-line JSON parser.
254
+
255
+ ```
256
+ $ slack users list | jq '.members | map({(.id): .name})'
257
+ [
258
+ {
259
+ "U04KB5WQR": "dblock"
260
+ },
261
+ {
262
+ "U07518DTL": "rubybot"
263
+ }
264
+ ]
265
+ ```
266
+
267
+ See `slack help` for a complete command-line reference.
268
+
181
269
  ## History
182
270
 
183
271
  This gem is based on [slack-ruby-gem](https://github.com/aki017/slack-ruby-gem), but it more clearly separates the Web and RTM APIs, is more thoroughly tested and is in active development.
@@ -26,10 +26,12 @@ Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version.
26
26
 
27
27
  Remove the line with "Your contribution here.", since there will be no more contributions to this release.
28
28
 
29
+ Remove the "Stable Release" section in README that warns users that they are reading the documentation for an unreleased version.
30
+
29
31
  Commit your changes.
30
32
 
31
33
  ```
32
- git add CHANGELOG.md lib/slack/version.rb
34
+ git add README.md CHANGELOG.md lib/slack/version.rb
33
35
  git commit -m "Preparing for release, 0.2.2."
34
36
  git push origin master
35
37
  ```
@@ -0,0 +1,26 @@
1
+ Upgrading Slack-Ruby-Client
2
+ ===========================
3
+
4
+ ### Upgrading to >= 0.5.0
5
+
6
+ #### Changes to Real Time Concurrency
7
+
8
+ Since 0.5.0 `Slack::RealTime::Client` supports [Celluloid](https://github.com/celluloid/celluloid) and no longer defaults to [Faye::WebSocket](https://github.com/faye/faye-websocket-ruby) with [Eventmachine](https://github.com/eventmachine/eventmachine). It will auto-detect one or the other depending on the gems in your Gemfile, which means you may need to add one or the other to your Gemfile.
9
+
10
+ ##### Faye::Websocket with Eventmachine
11
+
12
+ ```
13
+ gem 'faye-webSocket'
14
+ ```
15
+
16
+ ##### Celluloid
17
+
18
+ ```
19
+ gem 'celluloid-io'
20
+ ```
21
+
22
+ When in doubt, use Faye::WebSocket with Eventmachine.
23
+
24
+ See [#5](https://github.com/dblock/slack-ruby-client/issues/5) for more information.
25
+
26
+
@@ -0,0 +1,20 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ require 'commands/api'
4
+ require 'commands/auth'
5
+ require 'commands/channels'
6
+ require 'commands/chat'
7
+ require 'commands/emoji'
8
+ require 'commands/files'
9
+ require 'commands/groups'
10
+ require 'commands/im'
11
+ require 'commands/mpim'
12
+ require 'commands/oauth'
13
+ require 'commands/pins'
14
+ require 'commands/reactions'
15
+ require 'commands/rtm'
16
+ require 'commands/search'
17
+ require 'commands/stars'
18
+ require 'commands/team'
19
+ require 'commands/usergroups'
20
+ require 'commands/users'
@@ -0,0 +1,14 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Api methods.'
4
+ command 'api' do |g|
5
+ g.desc 'This method helps you test your calling code.'
6
+ g.long_desc %( This method helps you test your calling code. )
7
+ g.command 'test' do |c|
8
+ c.flag 'error', desc: 'Error response to return.'
9
+ c.flag 'foo', desc: 'example property to return.'
10
+ c.action do |_global_options, options, _args|
11
+ puts JSON.dump($client.api_test(options))
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Auth methods.'
4
+ command 'auth' do |g|
5
+ g.desc 'This method checks authentication and tells you who you are.'
6
+ g.long_desc %( This method checks authentication and tells you who you are. )
7
+ g.command 'test' do |c|
8
+ c.action do |_global_options, options, _args|
9
+ puts JSON.dump($client.auth_test(options))
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,140 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc "Get info on your team's Slack channels, create or archive channels, invite users, set the topic and purpose, and mark a channel as read."
4
+ command 'channels' do |g|
5
+ g.desc 'This method archives a channel.'
6
+ g.long_desc %( This method archives a channel. )
7
+ g.command 'archive' do |c|
8
+ c.flag 'channel', desc: 'Channel to archive.'
9
+ c.action do |_global_options, options, _args|
10
+ puts JSON.dump($client.channels_archive(options))
11
+ end
12
+ end
13
+
14
+ g.desc 'This method is used to create a channel.'
15
+ g.long_desc %( This method is used to create a channel. )
16
+ g.command 'create' do |c|
17
+ c.flag 'name', desc: 'Name of channel to create.'
18
+ c.action do |_global_options, options, _args|
19
+ puts JSON.dump($client.channels_create(options))
20
+ end
21
+ end
22
+
23
+ g.desc 'This method returns a portion of messages/events from the specified channel.'
24
+ g.long_desc %( This method returns a portion of messages/events from the specified channel. To read the entire history for a channel, call the method with no latest or oldest arguments, and then continue paging using the instructions below. )
25
+ g.command 'history' do |c|
26
+ c.flag 'channel', desc: 'Channel to fetch history for.'
27
+ c.flag 'latest', desc: 'End of time range of messages to include in results.'
28
+ c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
29
+ c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
30
+ c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
31
+ c.action do |_global_options, options, _args|
32
+ puts JSON.dump($client.channels_history(options))
33
+ end
34
+ end
35
+
36
+ g.desc 'This method returns information about a team channel.'
37
+ g.long_desc %( This method returns information about a team channel. )
38
+ g.command 'info' do |c|
39
+ c.flag 'channel', desc: 'Channel to get info on.'
40
+ c.action do |_global_options, options, _args|
41
+ puts JSON.dump($client.channels_info(options))
42
+ end
43
+ end
44
+
45
+ g.desc 'This method is used to invite a user to a channel. The calling user must be a member of the channel.'
46
+ g.long_desc %( This method is used to invite a user to a channel. The calling user must be a member of the channel. )
47
+ g.command 'invite' do |c|
48
+ c.flag 'channel', desc: 'Channel to invite user to.'
49
+ c.flag 'user', desc: 'User to invite to channel.'
50
+ c.action do |_global_options, options, _args|
51
+ puts JSON.dump($client.channels_invite(options))
52
+ end
53
+ end
54
+
55
+ g.desc 'This method is used to join a channel. If the channel does not exist, it is'
56
+ g.long_desc %( This method is used to join a channel. If the channel does not exist, it is created. )
57
+ g.command 'join' do |c|
58
+ c.flag 'name', desc: 'Name of channel to join.'
59
+ c.action do |_global_options, options, _args|
60
+ puts JSON.dump($client.channels_join(options))
61
+ end
62
+ end
63
+
64
+ g.desc 'This method allows a user to remove another member from a team channel.'
65
+ g.long_desc %( This method allows a user to remove another member from a team channel. )
66
+ g.command 'kick' do |c|
67
+ c.flag 'channel', desc: 'Channel to remove user from.'
68
+ c.flag 'user', desc: 'User to remove from channel.'
69
+ c.action do |_global_options, options, _args|
70
+ puts JSON.dump($client.channels_kick(options))
71
+ end
72
+ end
73
+
74
+ g.desc 'This method is used to leave a channel.'
75
+ g.long_desc %( This method is used to leave a channel. )
76
+ g.command 'leave' do |c|
77
+ c.flag 'channel', desc: 'Channel to leave.'
78
+ c.action do |_global_options, options, _args|
79
+ puts JSON.dump($client.channels_leave(options))
80
+ end
81
+ end
82
+
83
+ g.desc 'This method returns a list of all channels in the team. This includes channels the caller is in, channels'
84
+ g.long_desc %( This method returns a list of all channels in the team. This includes channels the caller is in, channels they are not currently in, and archived channels. The number of (non-deactivated) members in each channel is also returned. )
85
+ g.command 'list' do |c|
86
+ c.flag 'exclude_archived', desc: "Don't return archived channels."
87
+ c.action do |_global_options, options, _args|
88
+ puts JSON.dump($client.channels_list(options))
89
+ end
90
+ end
91
+
92
+ g.desc 'This method moves the read cursor in a channel.'
93
+ g.long_desc %( This method moves the read cursor in a channel. )
94
+ g.command 'mark' do |c|
95
+ c.flag 'channel', desc: 'Channel to set reading cursor in.'
96
+ c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
97
+ c.action do |_global_options, options, _args|
98
+ puts JSON.dump($client.channels_mark(options))
99
+ end
100
+ end
101
+
102
+ g.desc 'This method renames a team channel.'
103
+ g.long_desc %( This method renames a team channel. )
104
+ g.command 'rename' do |c|
105
+ c.flag 'channel', desc: 'Channel to rename.'
106
+ c.flag 'name', desc: 'New name for channel.'
107
+ c.action do |_global_options, options, _args|
108
+ puts JSON.dump($client.channels_rename(options))
109
+ end
110
+ end
111
+
112
+ g.desc 'This method is used to change the purpose of a channel. The calling user must be a member of the channel.'
113
+ g.long_desc %( This method is used to change the purpose of a channel. The calling user must be a member of the channel. )
114
+ g.command 'setPurpose' do |c|
115
+ c.flag 'channel', desc: 'Channel to set the purpose of.'
116
+ c.flag 'purpose', desc: 'The new purpose.'
117
+ c.action do |_global_options, options, _args|
118
+ puts JSON.dump($client.channels_setPurpose(options))
119
+ end
120
+ end
121
+
122
+ g.desc 'This method is used to change the topic of a channel. The calling user must be a member of the channel.'
123
+ g.long_desc %( This method is used to change the topic of a channel. The calling user must be a member of the channel. )
124
+ g.command 'setTopic' do |c|
125
+ c.flag 'channel', desc: 'Channel to set the topic of.'
126
+ c.flag 'topic', desc: 'The new topic.'
127
+ c.action do |_global_options, options, _args|
128
+ puts JSON.dump($client.channels_setTopic(options))
129
+ end
130
+ end
131
+
132
+ g.desc 'This method unarchives a channel. The calling user is added to the channel.'
133
+ g.long_desc %( This method unarchives a channel. The calling user is added to the channel. )
134
+ g.command 'unarchive' do |c|
135
+ c.flag 'channel', desc: 'Channel to unarchive.'
136
+ c.action do |_global_options, options, _args|
137
+ puts JSON.dump($client.channels_unarchive(options))
138
+ end
139
+ end
140
+ end