slack-ruby-client 0.7.0 → 0.7.1
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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +9 -9
- data/CHANGELOG.md +9 -1
- data/README.md +9 -1
- data/bin/commands/chat.rb +1 -0
- data/bin/commands/files.rb +3 -14
- data/bin/commands/files_comments.rb +35 -0
- data/bin/commands/reminders.rb +50 -0
- data/bin/commands/usergroups.rb +29 -40
- data/bin/commands/usergroups_users.rb +25 -0
- data/bin/commands.rb +3 -0
- data/bin/slack +3 -1
- data/examples/hi_real_time/hi.rb +5 -1
- data/lib/slack/real_time/client.rb +1 -0
- data/lib/slack/real_time/config.rb +1 -1
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/chat.rb +9 -1
- data/lib/slack/web/api/endpoints/files.rb +3 -22
- data/lib/slack/web/api/endpoints/files_comments.rb +59 -0
- data/lib/slack/web/api/endpoints/reminders.rb +74 -0
- data/lib/slack/web/api/endpoints/usergroups.rb +23 -40
- data/lib/slack/web/api/endpoints/usergroups_users.rb +42 -0
- data/lib/slack/web/api/endpoints.rb +6 -0
- data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +20 -0
- data/lib/slack/web/api/templates/command.erb +3 -3
- data/lib/slack/web/api/templates/endpoints.erb +1 -1
- data/lib/slack/web/api/templates/method.erb +2 -2
- data/lib/slack/web/api/templates/method_spec.erb +2 -2
- data/lib/slack/web/config.rb +1 -1
- data/lib/tasks/real_time.rake +1 -1
- data/lib/tasks/web.rake +11 -7
- data/slack-ruby-client.gemspec +1 -1
- data/spec/integration/integration_spec.rb +20 -0
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +36 -0
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +34 -0
- data/spec/slack/web/api/endpoints/files_spec.rb +1 -15
- data/spec/slack/web/api/endpoints/reminders_spec.rb +30 -0
- data/spec/slack/web/api/endpoints/usergroups_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +20 -0
- data/spec/support/vcr.rb +1 -0
- metadata +19 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98b81ae4b6471c6f769605ec94413778475e2867
|
4
|
+
data.tar.gz: 3f4a212131fbc5042d5eea7399606521ceafef97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56dff3761a755c63dccb02156317ba099f0e892be2152a3743bae95e04245c272cc55f42dad3d54d635d9e95f4347184fa4dc2a775e8c1e5e638778d71c8e71e
|
7
|
+
data.tar.gz: cf2ce35d6963d68b4c210eb852fe61f51cc9b0933b289fd000142ebfd3278b70dc07aa971da5e448e53ab1b63c00a6cec78a2e11533ecb3ea1be0bffc7550e97
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2016-02
|
3
|
+
# on 2016-05-02 08:01:33 -0400 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
|
@@ -21,34 +21,34 @@ Lint/UnusedBlockArgument:
|
|
21
21
|
Exclude:
|
22
22
|
- 'lib/slack/messages/formatting.rb'
|
23
23
|
|
24
|
-
# Offense count:
|
24
|
+
# Offense count: 15
|
25
25
|
Metrics/AbcSize:
|
26
26
|
Max: 44
|
27
27
|
|
28
28
|
# Offense count: 2
|
29
29
|
# Configuration parameters: CountComments.
|
30
30
|
Metrics/ClassLength:
|
31
|
-
Max:
|
31
|
+
Max: 155
|
32
32
|
|
33
|
-
# Offense count:
|
33
|
+
# Offense count: 2
|
34
34
|
Metrics/CyclomaticComplexity:
|
35
35
|
Max: 9
|
36
36
|
|
37
|
-
# Offense count:
|
37
|
+
# Offense count: 571
|
38
38
|
# Configuration parameters: AllowURI, URISchemes.
|
39
39
|
Metrics/LineLength:
|
40
40
|
Max: 288
|
41
41
|
|
42
|
-
# Offense count:
|
42
|
+
# Offense count: 7
|
43
43
|
# Configuration parameters: CountComments.
|
44
44
|
Metrics/MethodLength:
|
45
45
|
Max: 32
|
46
46
|
|
47
|
-
# Offense count:
|
47
|
+
# Offense count: 2
|
48
48
|
Metrics/PerceivedComplexity:
|
49
49
|
Max: 11
|
50
50
|
|
51
|
-
# Offense count:
|
51
|
+
# Offense count: 54
|
52
52
|
# Configuration parameters: Exclude.
|
53
53
|
Style/Documentation:
|
54
54
|
Enabled: false
|
@@ -59,7 +59,7 @@ Style/FileName:
|
|
59
59
|
Exclude:
|
60
60
|
- 'lib/slack-ruby-client.rb'
|
61
61
|
|
62
|
-
# Offense count:
|
62
|
+
# Offense count: 95
|
63
63
|
# Configuration parameters: AllowedVariables.
|
64
64
|
Style/GlobalVars:
|
65
65
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
### 0.7.1 (5/2/2016)
|
2
|
+
|
3
|
+
* [#82](https://github.com/dblock/slack-ruby-client/pull/82): Fix `usergroups.users.{list,update}` and `files.comments.{add,edit,delete}` APIs - [@masatomo](https://github.com/masatomo).
|
4
|
+
* [#73](https://github.com/dblock/slack-ruby-client/issues/73): Add a `closed` event - [@rkadyb](https://github.com/rkadyb).
|
5
|
+
* [#69](https://github.com/dblock/slack-ruby-client/issues/69): Add attachments support for `Slack::Web::Api::Endpoints::Chat.chat_update` - [@nicka](https://github.com/nicka).
|
6
|
+
* [#85](https://github.com/dblock/slack-ruby-client/issues/85): Compatibility with WebMock 2.0 - [@dblock](https://github.com/dblock).
|
7
|
+
* Added `as_user` to `chat_delete` Web API - [@dblock](https://github.com/dblock).
|
8
|
+
* Added `reminders_add`, `reminders_complete`, `reminders_delete`, `reminders_info` and `reminders_list` to Web API - [@dblock](https://github.com/dblock).
|
9
|
+
|
1
10
|
### 0.7.0 (3/6/2016)
|
2
11
|
|
3
12
|
* [#68](https://github.com/dblock/slack-ruby-client/issues/68): The `Slack::RealTime::Config#store_class` is now globally configurable - [@dblock](https://github.com/dblock).
|
@@ -91,4 +100,3 @@
|
|
91
100
|
### 0.1.0 (7/25/2015)
|
92
101
|
|
93
102
|
* Initial public release with Web and RealTime Messaging API support - [@dblock](https://github.com/dblock).
|
94
|
-
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messa
|
|
18
18
|
|
19
19
|
## Stable Release
|
20
20
|
|
21
|
-
You're reading the documentation for the **stable** release of slack-ruby-client, 0.7.
|
21
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, 0.7.1. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -194,6 +194,14 @@ client.on :message do |data|
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
+
client.on :close do |_data|
|
198
|
+
puts "Client is about to disconnect"
|
199
|
+
end
|
200
|
+
|
201
|
+
client.on :closed do |_data|
|
202
|
+
puts "Client has disconnected successfully!"
|
203
|
+
end
|
204
|
+
|
197
205
|
client.start!
|
198
206
|
```
|
199
207
|
|
data/bin/commands/chat.rb
CHANGED
@@ -7,6 +7,7 @@ command 'chat' do |g|
|
|
7
7
|
g.command 'delete' do |c|
|
8
8
|
c.flag 'ts', desc: 'Timestamp of the message to be deleted.'
|
9
9
|
c.flag 'channel', desc: 'Channel containing the message to be deleted.'
|
10
|
+
c.flag 'as_user', desc: 'Pass true to delete the message as the authed user. Bot users in this context are considered authed users.'
|
10
11
|
c.action do |_global_options, options, _args|
|
11
12
|
puts JSON.dump($client.chat_delete(options))
|
12
13
|
end
|
data/bin/commands/files.rb
CHANGED
@@ -2,17 +2,6 @@
|
|
2
2
|
|
3
3
|
desc 'Get info on files uploaded to Slack, upload new files to Slack.'
|
4
4
|
command 'files' do |g|
|
5
|
-
g.desc '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.'
|
6
|
-
g.long_desc %( 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. )
|
7
|
-
g.command 'comments' do |c|
|
8
|
-
c.flag 'file', desc: 'File containing the comment to edit.'
|
9
|
-
c.flag 'id', desc: 'The comment to edit.'
|
10
|
-
c.flag 'comment', desc: 'Text of the comment to edit.'
|
11
|
-
c.action do |_global_options, options, _args|
|
12
|
-
puts JSON.dump($client.files_comments(options))
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
5
|
g.desc 'This method deletes a file from your team.'
|
17
6
|
g.long_desc %( This method deletes a file from your team. )
|
18
7
|
g.command 'delete' do |c|
|
@@ -77,9 +66,9 @@ You can pass multiple values in the types argument, like types=posts,snippets.Th
|
|
77
66
|
g.desc 'This method allows you to create or upload an existing file.'
|
78
67
|
g.long_desc %( This method allows you to create or upload an existing file. )
|
79
68
|
g.command 'upload' do |c|
|
80
|
-
c.flag 'file', desc: 'File contents via multipart/form-data.'
|
81
|
-
c.flag 'content', desc: 'File contents via a POST
|
82
|
-
c.flag 'filetype', desc: '
|
69
|
+
c.flag 'file', desc: 'File contents via multipart/form-data. If omitting this parameter, you must submit content.'
|
70
|
+
c.flag 'content', desc: 'File contents via a POST variable. If omitting this parameter, you must provide a file.'
|
71
|
+
c.flag 'filetype', desc: 'A file type identifier.'
|
83
72
|
c.flag 'filename', desc: 'Filename of file.'
|
84
73
|
c.flag 'title', desc: 'Title of file.'
|
85
74
|
c.flag 'initial_comment', desc: 'Initial comment to add to file.'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
desc 'FilesComments methods.'
|
4
|
+
command 'files_comments' do |g|
|
5
|
+
g.desc 'Add a comment to an existing file.'
|
6
|
+
g.long_desc %( Add a comment to an existing file. )
|
7
|
+
g.command 'add' do |c|
|
8
|
+
c.flag 'file', desc: 'File to add a comment to.'
|
9
|
+
c.flag 'comment', desc: 'Text of the comment to add.'
|
10
|
+
c.action do |_global_options, options, _args|
|
11
|
+
puts JSON.dump($client.files_comments_add(options))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
g.desc 'Delete an existing comment on a file. Only the original author of the comment or a Team Administrator may delete a file comment.'
|
16
|
+
g.long_desc %( Delete an existing comment on a file. Only the original author of the comment or a Team Administrator may delete a file comment. )
|
17
|
+
g.command 'delete' do |c|
|
18
|
+
c.flag 'file', desc: 'File to delete a comment from.'
|
19
|
+
c.flag 'id', desc: 'The comment to delete.'
|
20
|
+
c.action do |_global_options, options, _args|
|
21
|
+
puts JSON.dump($client.files_comments_delete(options))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
g.desc '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.'
|
26
|
+
g.long_desc %( 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. )
|
27
|
+
g.command 'edit' do |c|
|
28
|
+
c.flag 'file', desc: 'File containing the comment to edit.'
|
29
|
+
c.flag 'id', desc: 'The comment to edit.'
|
30
|
+
c.flag 'comment', desc: 'Text of the comment to edit.'
|
31
|
+
c.action do |_global_options, options, _args|
|
32
|
+
puts JSON.dump($client.files_comments_edit(options))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
desc 'Reminders methods.'
|
4
|
+
command 'reminders' do |g|
|
5
|
+
g.desc 'This method creates a reminder.'
|
6
|
+
g.long_desc %( This method creates a reminder. )
|
7
|
+
g.command 'add' do |c|
|
8
|
+
c.flag 'text', desc: 'The content of the reminder.'
|
9
|
+
c.flag 'time', desc: 'When this reminder should happen: the Unix timestamp (up to five years from now), the number of seconds until the reminder (if within 24 hours), or a natural language description (Ex. "in 15 minutes," or "every Thursday").'
|
10
|
+
c.flag 'user', desc: 'The user who will receive the reminder. If no user is specified, the reminder will go to user who created it.'
|
11
|
+
c.action do |_global_options, options, _args|
|
12
|
+
puts JSON.dump($client.reminders_add(options))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
g.desc 'This method completes a reminder.'
|
17
|
+
g.long_desc %( This method completes a reminder. )
|
18
|
+
g.command 'complete' do |c|
|
19
|
+
c.flag 'reminder', desc: 'The ID of the reminder to be marked as complete.'
|
20
|
+
c.action do |_global_options, options, _args|
|
21
|
+
puts JSON.dump($client.reminders_complete(options))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
g.desc 'This method deletes a reminder.'
|
26
|
+
g.long_desc %( This method deletes a reminder. )
|
27
|
+
g.command 'delete' do |c|
|
28
|
+
c.flag 'reminder', desc: 'The ID of the reminder.'
|
29
|
+
c.action do |_global_options, options, _args|
|
30
|
+
puts JSON.dump($client.reminders_delete(options))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
g.desc 'This method returns information about a reminder.'
|
35
|
+
g.long_desc %( This method returns information about a reminder. )
|
36
|
+
g.command 'info' do |c|
|
37
|
+
c.flag 'reminder', desc: 'The ID of the reminder.'
|
38
|
+
c.action do |_global_options, options, _args|
|
39
|
+
puts JSON.dump($client.reminders_info(options))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
g.desc 'This method lists all reminders created by or for a given user.'
|
44
|
+
g.long_desc %( This method lists all reminders created by or for a given user. )
|
45
|
+
g.command 'list' do |c|
|
46
|
+
c.action do |_global_options, options, _args|
|
47
|
+
puts JSON.dump($client.reminders_list(options))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/bin/commands/usergroups.rb
CHANGED
@@ -1,73 +1,62 @@
|
|
1
1
|
# This file was auto-generated by lib/tasks/web.rake
|
2
2
|
|
3
|
-
desc "Get info on your team's
|
3
|
+
desc "Get info on your team's User Groups."
|
4
4
|
command 'usergroups' do |g|
|
5
|
-
g.desc 'This method is used to create a
|
6
|
-
g.long_desc %( This method is used to create a
|
5
|
+
g.desc 'This method is used to create a User Group.'
|
6
|
+
g.long_desc %( This method is used to create a User Group. )
|
7
7
|
g.command 'create' do |c|
|
8
|
-
c.flag 'name', desc: 'A name for the
|
9
|
-
c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and
|
10
|
-
c.flag 'description', desc: 'A short description of the
|
11
|
-
c.flag 'channels', desc: 'A comma separated string of encoded channel IDs for which the
|
12
|
-
c.flag 'include_count', desc: 'Include the number of users in each
|
8
|
+
c.flag 'name', desc: 'A name for the User Group. Must be unique among User Groups.'
|
9
|
+
c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and User Groups.'
|
10
|
+
c.flag 'description', desc: 'A short description of the User Group.'
|
11
|
+
c.flag 'channels', desc: 'A comma separated string of encoded channel IDs for which the User Group uses as a default.'
|
12
|
+
c.flag 'include_count', desc: 'Include the number of users in each User Group.'
|
13
13
|
c.action do |_global_options, options, _args|
|
14
14
|
puts JSON.dump($client.usergroups_create(options))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
g.desc 'This method disables an existing
|
19
|
-
g.long_desc %( This method disables an existing
|
18
|
+
g.desc 'This method disables an existing User Group.'
|
19
|
+
g.long_desc %( This method disables an existing User Group. )
|
20
20
|
g.command 'disable' do |c|
|
21
|
-
c.flag 'usergroup', desc: 'The encoded ID of the
|
22
|
-
c.flag 'include_count', desc: 'Include the number of users in the
|
21
|
+
c.flag 'usergroup', desc: 'The encoded ID of the User Group to disable.'
|
22
|
+
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
|
23
23
|
c.action do |_global_options, options, _args|
|
24
24
|
puts JSON.dump($client.usergroups_disable(options))
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
g.desc 'This method enables a
|
29
|
-
g.long_desc %( This method enables a
|
28
|
+
g.desc 'This method enables a User Group which was previously disabled.'
|
29
|
+
g.long_desc %( This method enables a User Group which was previously disabled. )
|
30
30
|
g.command 'enable' do |c|
|
31
|
-
c.flag 'usergroup', desc: 'The encoded ID of the
|
32
|
-
c.flag 'include_count', desc: 'Include the number of users in the
|
31
|
+
c.flag 'usergroup', desc: 'The encoded ID of the User Group to enable.'
|
32
|
+
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
|
33
33
|
c.action do |_global_options, options, _args|
|
34
34
|
puts JSON.dump($client.usergroups_enable(options))
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
g.desc 'This method returns a list of all
|
39
|
-
g.long_desc %( This method returns a list of all
|
38
|
+
g.desc 'This method returns a list of all User Groups in the team. This can optionally include disabled User Groups.'
|
39
|
+
g.long_desc %( This method returns a list of all User Groups in the team. This can optionally include disabled User Groups. )
|
40
40
|
g.command 'list' do |c|
|
41
|
-
c.flag 'include_disabled', desc: 'Include disabled
|
42
|
-
c.flag 'include_count', desc: 'Include the number of users in each
|
43
|
-
c.flag 'include_users', desc: 'Include the list of users for each
|
41
|
+
c.flag 'include_disabled', desc: 'Include disabled User Groups.'
|
42
|
+
c.flag 'include_count', desc: 'Include the number of users in each User Group.'
|
43
|
+
c.flag 'include_users', desc: 'Include the list of users for each User Group.'
|
44
44
|
c.action do |_global_options, options, _args|
|
45
45
|
puts JSON.dump($client.usergroups_list(options))
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
g.desc 'This method updates the properties of an existing
|
50
|
-
g.long_desc %( This method updates the properties of an existing
|
49
|
+
g.desc 'This method updates the properties of an existing User Group.'
|
50
|
+
g.long_desc %( This method updates the properties of an existing User Group. )
|
51
51
|
g.command 'update' do |c|
|
52
|
-
c.flag 'usergroup', desc: 'The encoded ID of the
|
53
|
-
c.flag 'name', desc: 'A name for the
|
54
|
-
c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and
|
55
|
-
c.flag 'description', desc: 'A short description of the
|
56
|
-
c.flag 'channels', desc: 'A comma separated string of encoded channel IDs for which the
|
57
|
-
c.flag 'include_count', desc: 'Include the number of users in the
|
52
|
+
c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
|
53
|
+
c.flag 'name', desc: 'A name for the User Group. Must be unique among User Groups.'
|
54
|
+
c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and User Groups.'
|
55
|
+
c.flag 'description', desc: 'A short description of the User Group.'
|
56
|
+
c.flag 'channels', desc: 'A comma separated string of encoded channel IDs for which the User Group uses as a default.'
|
57
|
+
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
|
58
58
|
c.action do |_global_options, options, _args|
|
59
59
|
puts JSON.dump($client.usergroups_update(options))
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
63
|
-
g.desc 'This method updates the list of users that belong to a user group. This method replaces all users in a user group with the list of users provided in the users parameter.'
|
64
|
-
g.long_desc %( This method updates the list of users that belong to a user group. This method replaces all users in a user group with the list of users provided in the users parameter. )
|
65
|
-
g.command 'users' do |c|
|
66
|
-
c.flag 'usergroup', desc: 'The encoded ID of the user group to update.'
|
67
|
-
c.flag 'users', desc: 'A comma separated string of encoded user IDs that represent the entire list of users for the user group.'
|
68
|
-
c.flag 'include_count', desc: 'Include the number of users in the user group.'
|
69
|
-
c.action do |_global_options, options, _args|
|
70
|
-
puts JSON.dump($client.usergroups_users(options))
|
71
|
-
end
|
72
|
-
end
|
73
62
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
desc 'UsergroupsUsers methods.'
|
4
|
+
command 'usergroups_users' do |g|
|
5
|
+
g.desc 'This method returns a list of all users within a User Group.'
|
6
|
+
g.long_desc %( This method returns a list of all users within a User Group. )
|
7
|
+
g.command 'list' do |c|
|
8
|
+
c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
|
9
|
+
c.flag 'include_disabled', desc: 'Allow results that involve disabled User Groups.'
|
10
|
+
c.action do |_global_options, options, _args|
|
11
|
+
puts JSON.dump($client.usergroups_users_list(options))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
g.desc 'This method updates the list of users that belong to a User Group. This method replaces all users in a User Group with the list of users provided in the users parameter.'
|
16
|
+
g.long_desc %( This method updates the list of users that belong to a User Group. This method replaces all users in a User Group with the list of users provided in the users parameter. )
|
17
|
+
g.command 'update' do |c|
|
18
|
+
c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
|
19
|
+
c.flag 'users', desc: 'A comma separated string of encoded user IDs that represent the entire list of users for the User Group.'
|
20
|
+
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
|
21
|
+
c.action do |_global_options, options, _args|
|
22
|
+
puts JSON.dump($client.usergroups_users_update(options))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/bin/commands.rb
CHANGED
@@ -6,6 +6,7 @@ require 'commands/channels'
|
|
6
6
|
require 'commands/chat'
|
7
7
|
require 'commands/dnd'
|
8
8
|
require 'commands/emoji'
|
9
|
+
require 'commands/files_comments'
|
9
10
|
require 'commands/files'
|
10
11
|
require 'commands/groups'
|
11
12
|
require 'commands/im'
|
@@ -13,9 +14,11 @@ require 'commands/mpim'
|
|
13
14
|
require 'commands/oauth'
|
14
15
|
require 'commands/pins'
|
15
16
|
require 'commands/reactions'
|
17
|
+
require 'commands/reminders'
|
16
18
|
require 'commands/rtm'
|
17
19
|
require 'commands/search'
|
18
20
|
require 'commands/stars'
|
19
21
|
require 'commands/team'
|
20
22
|
require 'commands/usergroups'
|
23
|
+
require 'commands/usergroups_users'
|
21
24
|
require 'commands/users'
|
data/bin/slack
CHANGED
@@ -16,7 +16,7 @@ flag ['vcr-cassette-name'], desc: 'Offline VCR cassette.'
|
|
16
16
|
pre do |global_options, _command, options, _args|
|
17
17
|
# global Slack configuration
|
18
18
|
Slack.config.token = global_options['slack-api-token']
|
19
|
-
help_now! 'Set Slack API token via --slack-api-token or SLACK_API_TOKEN.' unless Slack.config.token && Slack.config.token.
|
19
|
+
help_now! 'Set Slack API token via --slack-api-token or SLACK_API_TOKEN.' unless Slack.config.token && !Slack.config.token.empty?
|
20
20
|
|
21
21
|
if global_options['debug']
|
22
22
|
require 'logger'
|
@@ -29,6 +29,8 @@ pre do |global_options, _command, options, _args|
|
|
29
29
|
|
30
30
|
# Offline VCR cassette
|
31
31
|
if global_options['vcr-cassette-name']
|
32
|
+
require 'webmock'
|
33
|
+
WebMock.enable!
|
32
34
|
require 'vcr'
|
33
35
|
VCR.configure do |config|
|
34
36
|
config.cassette_library_dir = 'spec/fixtures/slack'
|
data/examples/hi_real_time/hi.rb
CHANGED
@@ -27,8 +27,12 @@ client.on :message do |data|
|
|
27
27
|
end
|
28
28
|
|
29
29
|
client.on :close do |_data|
|
30
|
-
puts 'Connection
|
30
|
+
puts 'Connection closing, exiting.'
|
31
31
|
EM.stop
|
32
32
|
end
|
33
33
|
|
34
|
+
client.on :closed do |_data|
|
35
|
+
puts 'Connection has been disconnected.'
|
36
|
+
end
|
37
|
+
|
34
38
|
client.start!
|