slack-ruby-client 0.14.2 → 0.14.3
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 +4 -3
- data/CHANGELOG.md +7 -0
- data/Gemfile +8 -1
- data/README.md +2 -2
- data/UPGRADING.md +10 -0
- data/bin/commands.rb +1 -0
- data/bin/commands/admin_users_session.rb +15 -0
- data/bin/commands/apps.rb +2 -2
- data/bin/commands/chat.rb +4 -1
- data/bin/commands/conversations.rb +34 -34
- data/bin/commands/groups.rb +1 -1
- data/bin/commands/pins.rb +2 -2
- data/bin/commands/team.rb +1 -0
- data/bin/commands/users.rb +2 -2
- data/lib/slack/real_time/client.rb +23 -10
- data/lib/slack/real_time/concurrency/async.rb +6 -3
- data/lib/slack/real_time/stores/starter.rb +10 -0
- data/lib/slack/real_time/stores/store.rb +10 -0
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +2 -0
- data/lib/slack/web/api/endpoints/admin_users_session.rb +27 -0
- data/lib/slack/web/api/endpoints/apps.rb +1 -1
- data/lib/slack/web/api/endpoints/chat.rb +8 -2
- data/lib/slack/web/api/endpoints/conversations.rb +17 -17
- data/lib/slack/web/api/endpoints/dnd.rb +1 -0
- data/lib/slack/web/api/endpoints/groups.rb +4 -0
- data/lib/slack/web/api/endpoints/pins.rb +2 -2
- data/lib/slack/web/api/endpoints/team.rb +2 -0
- data/lib/slack/web/api/endpoints/users.rb +5 -1
- data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +5 -3
- data/spec/slack/real_time/client_spec.rb +25 -0
- data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +12 -0
- data/spec/slack/web/api/endpoints/dnd_spec.rb +5 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52a5d3c9923ec690ce3051c29b1dbf352a51ddc767fe97b073e57d1475bc62c0
|
4
|
+
data.tar.gz: 573ca30fa89b54863b445bc4132382f9b2c7d9ec5054e24d0ca8998aed43d1d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54c5b782b45afb9268adfe9511b622d28d9d1e17db1e3cbdec0ffc6490870ef8ce7c12b9d20f1f580991bae9824e32a803509fca7acd912ad0dd2b9ce193ffb4
|
7
|
+
data.tar.gz: 513a1fe8c32d952a9ac6c5a848e63ccfcd372616434f4aba62e00cdf107dea191c4bfa072acde577ca5df4f7aa29b86225419741a0f203bb73f92e488f443338
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2019-
|
3
|
+
# on 2019-07-21 18:39:19 -0400 using RuboCop version 0.61.1.
|
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
|
@@ -13,10 +13,11 @@ Lint/AssignmentInCondition:
|
|
13
13
|
- 'lib/slack/real_time/concurrency/async.rb'
|
14
14
|
- 'lib/slack/real_time/socket.rb'
|
15
15
|
|
16
|
-
# Offense count:
|
16
|
+
# Offense count: 5
|
17
17
|
Lint/HandleExceptions:
|
18
18
|
Exclude:
|
19
19
|
- 'lib/slack-ruby-client.rb'
|
20
|
+
- 'lib/slack/real_time/concurrency/async.rb'
|
20
21
|
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
|
21
22
|
- 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
|
22
23
|
|
@@ -50,7 +51,7 @@ Style/AccessModifierDeclarations:
|
|
50
51
|
- 'lib/slack/real_time/concurrency/eventmachine.rb'
|
51
52
|
- 'lib/slack/real_time/socket.rb'
|
52
53
|
|
53
|
-
# Offense count:
|
54
|
+
# Offense count: 155
|
54
55
|
# Configuration parameters: AllowedVariables.
|
55
56
|
Style/GlobalVars:
|
56
57
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
### 0.14.3 (2019/7/23)
|
2
|
+
|
3
|
+
* [#279](https://github.com/slack-ruby/slack-ruby-client/pull/279): Prevent ping worker from dying on unexpected errors - [@dblock](https://github.com/dblock).
|
4
|
+
* [#281](https://github.com/slack-ruby/slack-ruby-client/pull/281): Added `admin_users_session_reset` to Web API - [@dblock](https://github.com/dblock).
|
5
|
+
* [#283](https://github.com/slack-ruby/slack-ruby-client/pull/283): Fail when used with incompatible async-websocket > 0.8.0 - [@dblock](https://github.com/dblock).
|
6
|
+
* [#284](https://github.com/slack-ruby/slack-ruby-client/pull/284): Include team id, name and domain in log output - [@dblock](https://github.com/dblock).
|
7
|
+
|
1
8
|
### 0.14.2 (2019/4/12)
|
2
9
|
|
3
10
|
* [#256](https://github.com/slack-ruby/slack-ruby-client/pull/256): Added support for specifying signing secrets on a per-request basis via optional parameters to the `Slack::Events::Request` constructor - [@gabrielmdeal](https://github.com/gabrielmdeal).
|
data/Gemfile
CHANGED
@@ -2,7 +2,14 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
5
|
+
if ENV.key?('CONCURRENCY')
|
6
|
+
case ENV['CONCURRENCY']
|
7
|
+
when 'async-websocket'
|
8
|
+
gem 'async-websocket', '~> 0.8.0', require: false
|
9
|
+
else
|
10
|
+
gem ENV['CONCURRENCY'], require: false
|
11
|
+
end
|
12
|
+
end
|
6
13
|
|
7
14
|
group :test do
|
8
15
|
gem 'danger-toc', '~> 0.1.3', require: false
|
data/README.md
CHANGED
@@ -66,7 +66,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
66
66
|
|
67
67
|
## Stable Release
|
68
68
|
|
69
|
-
You're reading the documentation for the **stable** release of slack-ruby-client, 0.14.
|
69
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, 0.14.3. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
70
70
|
|
71
71
|
## Installation
|
72
72
|
|
@@ -79,7 +79,7 @@ gem 'slack-ruby-client'
|
|
79
79
|
If you're going to be using the RealTime client, add either `async-websocket`, `eventmachine` and `faye-websocket` or `celluloid-io`. See below for more information about concurrency. We recommend you use `async-websocket`.
|
80
80
|
|
81
81
|
```
|
82
|
-
gem 'async-websocket'
|
82
|
+
gem 'async-websocket', '~> 0.8.0'
|
83
83
|
```
|
84
84
|
|
85
85
|
Run `bundle install`.
|
data/UPGRADING.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
Upgrading Slack-Ruby-Client
|
2
2
|
===========================
|
3
3
|
|
4
|
+
### Upgrading to >= 0.14.0
|
5
|
+
|
6
|
+
If you are using async-websocket, lock down its version to 0.8.0 as newer versions are currently incompatible.
|
7
|
+
|
8
|
+
```
|
9
|
+
gem 'async-websocket', '~> 0.8.0'
|
10
|
+
```
|
11
|
+
|
12
|
+
See [#282](https://github.com/slack-ruby/slack-ruby-client/issues/282) for more information.
|
13
|
+
|
4
14
|
### Upgrading to >= 0.13.0
|
5
15
|
|
6
16
|
#### Recommended Async Library
|
data/bin/commands.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
desc 'AdminUsersSession methods.'
|
4
|
+
command 'admin_users_session' do |g|
|
5
|
+
g.desc "This method wipes a user session, leaving the user unauthenticated. The user's Slack client will reset its local cache."
|
6
|
+
g.long_desc %( This method wipes a user session, leaving the user unauthenticated. The user's Slack client will reset its local cache. )
|
7
|
+
g.command 'reset' do |c|
|
8
|
+
c.flag 'user_id', desc: 'The ID of the user to wipe sessions for.'
|
9
|
+
c.flag 'mobile_only', desc: 'Only expire mobile sessions (default: false).'
|
10
|
+
c.flag 'web_only', desc: 'Only expire web sessions (default: false).'
|
11
|
+
c.action do |_global_options, options, _args|
|
12
|
+
puts JSON.dump($client.admin_users_session_reset(options))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/bin/commands/apps.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
desc 'Apps methods.'
|
4
4
|
command 'apps' do |g|
|
5
|
-
g.desc 'This method uninstalls
|
6
|
-
g.long_desc %( This method uninstalls
|
5
|
+
g.desc 'This method uninstalls an app. Unlike auth.revoke, which revokes a single token, this method revokes all tokens associated with a single installation of an app.'
|
6
|
+
g.long_desc %( This method uninstalls an app. Unlike auth.revoke, which revokes a single token, this method revokes all tokens associated with a single installation of an app. )
|
7
7
|
g.command 'uninstall' do |c|
|
8
8
|
c.flag 'client_id', desc: 'Issued when you created your application.'
|
9
9
|
c.flag 'client_secret', desc: 'Issued when you created your application.'
|
data/bin/commands/chat.rb
CHANGED
@@ -58,15 +58,18 @@ command 'chat' do |g|
|
|
58
58
|
g.desc 'This method posts an ephemeral message, which is visible only to the assigned user in a specific public channel, private channel, or private conversation.'
|
59
59
|
g.long_desc %( This method posts an ephemeral message, which is visible only to the assigned user in a specific public channel, private channel, or private conversation. )
|
60
60
|
g.command 'postEphemeral' do |c|
|
61
|
+
c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
|
61
62
|
c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.'
|
62
63
|
c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead."
|
63
64
|
c.flag 'user', desc: 'id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.'
|
64
65
|
c.flag 'as_user', desc: 'Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.'
|
65
|
-
c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
|
66
66
|
c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.'
|
67
|
+
c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
|
68
|
+
c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
|
67
69
|
c.flag 'link_names', desc: 'Find and link channel names and usernames.'
|
68
70
|
c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.'
|
69
71
|
c.flag 'thread_ts', desc: "Provide another message's ts value to post this message in a thread. Avoid using a reply's ts value; use its parent's value instead. Ephemeral messages in threads are only shown if there is already an active thread."
|
72
|
+
c.flag 'username', desc: "Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below."
|
70
73
|
c.action do |_global_options, options, _args|
|
71
74
|
puts JSON.dump($client.chat_postEphemeral(options))
|
72
75
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
desc 'Conversations methods.'
|
4
4
|
command 'conversations' do |g|
|
5
|
-
g.desc
|
6
|
-
g.long_desc %(
|
5
|
+
g.desc 'This method archives a conversation. Not all types of conversations can be archived.'
|
6
|
+
g.long_desc %( This method archives a conversation. Not all types of conversations can be archived. )
|
7
7
|
g.command 'archive' do |c|
|
8
8
|
c.flag 'channel', desc: 'ID of conversation to archive.'
|
9
9
|
c.action do |_global_options, options, _args|
|
@@ -11,8 +11,8 @@ command 'conversations' do |g|
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
g.desc
|
15
|
-
g.long_desc %(
|
14
|
+
g.desc 'This Conversations API method closes direct messages, multi-person or 1:1 or otherwise.'
|
15
|
+
g.long_desc %( This Conversations API method closes direct messages, multi-person or 1:1 or otherwise. )
|
16
16
|
g.command 'close' do |c|
|
17
17
|
c.flag 'channel', desc: 'Conversation to close.'
|
18
18
|
c.action do |_global_options, options, _args|
|
@@ -20,8 +20,8 @@ command 'conversations' do |g|
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
g.desc
|
24
|
-
g.long_desc %(
|
23
|
+
g.desc 'Create a public or private channel using this Conversations API method.'
|
24
|
+
g.long_desc %( Create a public or private channel using this Conversations API method. )
|
25
25
|
g.command 'create' do |c|
|
26
26
|
c.flag 'name', desc: 'Name of the public or private channel to create.'
|
27
27
|
c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
|
@@ -31,8 +31,8 @@ command 'conversations' do |g|
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
g.desc
|
35
|
-
g.long_desc %(
|
34
|
+
g.desc 'This method returns a portion of message events from the specified conversation.'
|
35
|
+
g.long_desc %( This method returns a portion of message events from the specified conversation. )
|
36
36
|
g.command 'history' do |c|
|
37
37
|
c.flag 'channel', desc: 'Conversation ID to fetch history for.'
|
38
38
|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
|
@@ -45,8 +45,8 @@ command 'conversations' do |g|
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
g.desc
|
49
|
-
g.long_desc %(
|
48
|
+
g.desc 'This Conversations API method returns information about a workspace conversation.'
|
49
|
+
g.long_desc %( This Conversations API method returns information about a workspace conversation. )
|
50
50
|
g.command 'info' do |c|
|
51
51
|
c.flag 'channel', desc: 'Conversation ID to learn more about.'
|
52
52
|
c.flag 'include_locale', desc: 'Set this to true to receive the locale for this conversation. Defaults to false.'
|
@@ -56,8 +56,8 @@ command 'conversations' do |g|
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
g.desc
|
60
|
-
g.long_desc %(
|
59
|
+
g.desc 'This Conversations API method invites 1-30 users to a public or private channel. The calling user must be a member of the channel.'
|
60
|
+
g.long_desc %( This Conversations API method invites 1-30 users to a public or private channel. The calling user must be a member of the channel. )
|
61
61
|
g.command 'invite' do |c|
|
62
62
|
c.flag 'channel', desc: 'The ID of the public or private channel to invite user(s) to.'
|
63
63
|
c.flag 'users', desc: 'A comma separated list of user IDs. Up to 30 users may be listed.'
|
@@ -66,8 +66,8 @@ command 'conversations' do |g|
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
g.desc
|
70
|
-
g.long_desc %(
|
69
|
+
g.desc 'This Conversations API method joins a user to an existing conversation.'
|
70
|
+
g.long_desc %( This Conversations API method joins a user to an existing conversation. )
|
71
71
|
g.command 'join' do |c|
|
72
72
|
c.flag 'channel', desc: 'ID of conversation to join.'
|
73
73
|
c.action do |_global_options, options, _args|
|
@@ -75,8 +75,8 @@ command 'conversations' do |g|
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
g.desc
|
79
|
-
g.long_desc %(
|
78
|
+
g.desc 'This Conversations API method allows a user to remove another member from a channel.'
|
79
|
+
g.long_desc %( This Conversations API method allows a user to remove another member from a channel. )
|
80
80
|
g.command 'kick' do |c|
|
81
81
|
c.flag 'channel', desc: 'ID of conversation to remove user from.'
|
82
82
|
c.flag 'user', desc: 'User ID to be removed.'
|
@@ -85,8 +85,8 @@ command 'conversations' do |g|
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
g.desc
|
89
|
-
g.long_desc %(
|
88
|
+
g.desc 'This Conversations API method makes like a tree and leaves a conversation.'
|
89
|
+
g.long_desc %( This Conversations API method makes like a tree and leaves a conversation. )
|
90
90
|
g.command 'leave' do |c|
|
91
91
|
c.flag 'channel', desc: 'Conversation to leave.'
|
92
92
|
c.action do |_global_options, options, _args|
|
@@ -94,8 +94,8 @@ command 'conversations' do |g|
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
g.desc
|
98
|
-
g.long_desc %(
|
97
|
+
g.desc 'This Conversations API method returns a list of all channel-like conversations in a workspace. The "channels" returned depend on what the calling token has access to and the directives placed in the types parameter.'
|
98
|
+
g.long_desc %( This Conversations API method returns a list of all channel-like conversations in a workspace. The "channels" returned depend on what the calling token has access to and the directives placed in the types parameter. )
|
99
99
|
g.command 'list' do |c|
|
100
100
|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
|
101
101
|
c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
|
@@ -106,8 +106,8 @@ command 'conversations' do |g|
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
g.desc
|
110
|
-
g.long_desc %(
|
109
|
+
g.desc 'This Conversations API method returns a paginated list of members party to a conversation.'
|
110
|
+
g.long_desc %( This Conversations API method returns a paginated list of members party to a conversation. )
|
111
111
|
g.command 'members' do |c|
|
112
112
|
c.flag 'channel', desc: 'ID of the conversation to retrieve members for.'
|
113
113
|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
|
@@ -117,8 +117,8 @@ command 'conversations' do |g|
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
g.desc
|
121
|
-
g.long_desc %(
|
120
|
+
g.desc 'This Conversations API method opens a multi-person direct message or just a 1:1 direct message.'
|
121
|
+
g.long_desc %( This Conversations API method opens a multi-person direct message or just a 1:1 direct message. )
|
122
122
|
g.command 'open' do |c|
|
123
123
|
c.flag 'channel', desc: "Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead."
|
124
124
|
c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
|
@@ -128,8 +128,8 @@ command 'conversations' do |g|
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
g.desc
|
132
|
-
g.long_desc %(
|
131
|
+
g.desc 'This method renames a conversation. Some types of conversations cannot be renamed.'
|
132
|
+
g.long_desc %( This method renames a conversation. Some types of conversations cannot be renamed. )
|
133
133
|
g.command 'rename' do |c|
|
134
134
|
c.flag 'channel', desc: 'ID of conversation to rename.'
|
135
135
|
c.flag 'name', desc: 'New name for conversation.'
|
@@ -138,8 +138,8 @@ command 'conversations' do |g|
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
g.desc
|
142
|
-
g.long_desc %(
|
141
|
+
g.desc 'This Conversations API method returns an entire thread (a message plus all the messages in reply to it), while conversations.history method returns only parent messages.'
|
142
|
+
g.long_desc %( This Conversations API method returns an entire thread (a message plus all the messages in reply to it), while conversations.history method returns only parent messages. )
|
143
143
|
g.command 'replies' do |c|
|
144
144
|
c.flag 'channel', desc: 'Conversation ID to fetch thread from.'
|
145
145
|
c.flag 'ts', desc: "Unique identifier of a thread's parent message."
|
@@ -153,8 +153,8 @@ command 'conversations' do |g|
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
-
g.desc
|
157
|
-
g.long_desc %(
|
156
|
+
g.desc 'This method is used to change the purpose of a conversation. The calling user must be a member of the conversation. Not all conversation types may have a purpose set.'
|
157
|
+
g.long_desc %( This method is used to change the purpose of a conversation. The calling user must be a member of the conversation. Not all conversation types may have a purpose set. )
|
158
158
|
g.command 'setPurpose' do |c|
|
159
159
|
c.flag 'channel', desc: 'Conversation to set the purpose of.'
|
160
160
|
c.flag 'purpose', desc: 'A new, specialer purpose.'
|
@@ -163,8 +163,8 @@ command 'conversations' do |g|
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
g.desc
|
167
|
-
g.long_desc %(
|
166
|
+
g.desc 'This method is used to change the topic of a conversation. The calling user must be a member of the conversation. Not all conversation types support a new topic.'
|
167
|
+
g.long_desc %( This method is used to change the topic of a conversation. The calling user must be a member of the conversation. Not all conversation types support a new topic. )
|
168
168
|
g.command 'setTopic' do |c|
|
169
169
|
c.flag 'channel', desc: 'Conversation to set the topic of.'
|
170
170
|
c.flag 'topic', desc: 'The new topic string. Does not support formatting or linkification.'
|
@@ -173,8 +173,8 @@ command 'conversations' do |g|
|
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
-
g.desc
|
177
|
-
g.long_desc %(
|
176
|
+
g.desc 'This method unarchives a conversation. The calling user is added to the conversation.'
|
177
|
+
g.long_desc %( This method unarchives a conversation. The calling user is added to the conversation. )
|
178
178
|
g.command 'unarchive' do |c|
|
179
179
|
c.flag 'channel', desc: 'ID of conversation to unarchive.'
|
180
180
|
c.action do |_global_options, options, _args|
|
data/bin/commands/groups.rb
CHANGED
@@ -22,7 +22,7 @@ command 'groups' do |g|
|
|
22
22
|
end
|
23
23
|
|
24
24
|
g.desc 'This method takes an existing private channel and performs the following steps:'
|
25
|
-
g.long_desc %( This method takes an existing private channel and performs the following steps: )
|
25
|
+
g.long_desc %( This method takes an existing private channel and performs the following steps: - Renames the existing private channel (from "example" to "example-archived"). - Archives the existing private channel. - Creates a new private channel with the name of the existing private channel. - Adds all members of the existing private channel to the new private channel. )
|
26
26
|
g.command 'createChild' do |c|
|
27
27
|
c.flag 'channel', desc: 'Private channel to clone and archive.'
|
28
28
|
c.action do |_global_options, options, _args|
|
data/bin/commands/pins.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
desc 'Pins methods.'
|
4
4
|
command 'pins' do |g|
|
5
|
-
g.desc 'This method pins
|
6
|
-
g.long_desc %( This method pins
|
5
|
+
g.desc 'This method pins a channel message or group message to a particular channel.'
|
6
|
+
g.long_desc %( This method pins a channel message or group message to a particular channel. The channel argument is required and timestamp must also be specified. )
|
7
7
|
g.command 'add' do |c|
|
8
8
|
c.flag 'channel', desc: 'Channel to pin the item in.'
|
9
9
|
c.flag 'file', desc: 'File to pin.'
|
data/bin/commands/team.rb
CHANGED
@@ -23,6 +23,7 @@ command 'team' do |g|
|
|
23
23
|
g.desc 'This method provides information about your team.'
|
24
24
|
g.long_desc %( This method provides information about your team. )
|
25
25
|
g.command 'info' do |c|
|
26
|
+
c.flag 'team', desc: 'Team to get info on, if omitted, will return information about the current team. Will only return team that the authenticated token is allowed to see through external shared channels.'
|
26
27
|
c.action do |_global_options, options, _args|
|
27
28
|
puts JSON.dump($client.team_info(options))
|
28
29
|
end
|
data/bin/commands/users.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
desc 'Users methods.'
|
4
4
|
command 'users' do |g|
|
5
|
-
g.desc
|
6
|
-
g.long_desc %(
|
5
|
+
g.desc 'This method helps answer questions like:'
|
6
|
+
g.long_desc %( This method helps answer questions like: - Which conversations am I a member of? - Which public channels is my bot user in? - Do I have any direct messages open with my friend Suzy? - Is my bot a member of any private channels? )
|
7
7
|
g.command 'conversations' do |c|
|
8
8
|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
|
9
9
|
c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
|
@@ -82,18 +82,18 @@ module Slack
|
|
82
82
|
def run_loop
|
83
83
|
@socket.connect! do |driver|
|
84
84
|
driver.on :open do |event|
|
85
|
-
logger.debug("#{self
|
85
|
+
logger.debug("#{self}##{__method__}") { event.class.name }
|
86
86
|
open(event)
|
87
87
|
callback(event, :open)
|
88
88
|
end
|
89
89
|
|
90
90
|
driver.on :message do |event|
|
91
|
-
logger.debug("#{self
|
91
|
+
logger.debug("#{self}##{__method__}") { "#{event.class}, #{event.data}" }
|
92
92
|
dispatch(event)
|
93
93
|
end
|
94
94
|
|
95
95
|
driver.on :close do |event|
|
96
|
-
logger.debug("#{self
|
96
|
+
logger.debug("#{self}##{__method__}") { event.class.name }
|
97
97
|
callback(event, :close)
|
98
98
|
close(event)
|
99
99
|
callback(event, :closed)
|
@@ -127,17 +127,30 @@ module Slack
|
|
127
127
|
def run_ping!
|
128
128
|
return if keep_alive?
|
129
129
|
|
130
|
+
logger.warn(to_s) { 'is offline' }
|
131
|
+
|
130
132
|
restart_async
|
133
|
+
rescue StandardError => e
|
134
|
+
# disregard all ping worker failures, keep pinging
|
135
|
+
logger.debug("#{self}##{__method__}") { e }
|
131
136
|
end
|
132
137
|
|
133
138
|
def run_ping?
|
134
139
|
!websocket_ping.nil? && websocket_ping > 0
|
135
140
|
end
|
136
141
|
|
142
|
+
def to_s
|
143
|
+
if store && store.team
|
144
|
+
"id=#{store.team.id}, name=#{store.team.name}, domain=#{store.team.domain}"
|
145
|
+
else
|
146
|
+
super
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
137
150
|
protected
|
138
151
|
|
139
152
|
def restart_async
|
140
|
-
logger.debug("#{self
|
153
|
+
logger.debug("#{self}##{__method__}")
|
141
154
|
@socket.close
|
142
155
|
start = web_client.send(rtm_start_method, start_options)
|
143
156
|
data = Slack::Messages::Message.new(start)
|
@@ -183,7 +196,7 @@ module Slack
|
|
183
196
|
def send_json(data)
|
184
197
|
raise ClientNotStartedError unless started?
|
185
198
|
|
186
|
-
logger.debug("#{self
|
199
|
+
logger.debug("#{self}##{__method__}") { data }
|
187
200
|
@socket.send_data(data.to_json)
|
188
201
|
end
|
189
202
|
|
@@ -204,7 +217,7 @@ module Slack
|
|
204
217
|
end
|
205
218
|
true
|
206
219
|
rescue StandardError => e
|
207
|
-
logger.error e
|
220
|
+
logger.error("#{self}##{__method__}") { e }
|
208
221
|
false
|
209
222
|
end
|
210
223
|
|
@@ -216,11 +229,11 @@ module Slack
|
|
216
229
|
return false unless type
|
217
230
|
|
218
231
|
type = type.to_s
|
219
|
-
logger.debug("#{self
|
232
|
+
logger.debug("#{self}##{__method__}") { data.to_s }
|
220
233
|
run_handlers(type, data) if @store
|
221
234
|
run_callbacks(type, data)
|
222
235
|
rescue StandardError => e
|
223
|
-
logger.error e
|
236
|
+
logger.error("#{self}##{__method__}") { e }
|
224
237
|
false
|
225
238
|
end
|
226
239
|
|
@@ -232,7 +245,7 @@ module Slack
|
|
232
245
|
end
|
233
246
|
end
|
234
247
|
rescue StandardError => e
|
235
|
-
logger.error e
|
248
|
+
logger.error("#{self}##{__method__}") { e }
|
236
249
|
false
|
237
250
|
end
|
238
251
|
|
@@ -245,7 +258,7 @@ module Slack
|
|
245
258
|
end
|
246
259
|
true
|
247
260
|
rescue StandardError => e
|
248
|
-
logger.error e
|
261
|
+
logger.error("#{self}##{__method__}") { e }
|
249
262
|
false
|
250
263
|
end
|
251
264
|
end
|
@@ -30,7 +30,7 @@ module Slack
|
|
30
30
|
|
31
31
|
if client.run_ping?
|
32
32
|
@ping_task = task.async do |subtask|
|
33
|
-
subtask.annotate
|
33
|
+
subtask.annotate "#{client} keep-alive"
|
34
34
|
|
35
35
|
# The timer task will naturally exit after the driver is set to nil.
|
36
36
|
while @restart
|
@@ -45,11 +45,12 @@ module Slack
|
|
45
45
|
|
46
46
|
@client_task = task.async do |subtask|
|
47
47
|
begin
|
48
|
-
subtask.annotate
|
48
|
+
subtask.annotate "#{client} run-loop"
|
49
49
|
client.run_loop
|
50
50
|
rescue ::Async::Wrapper::Cancelled => e
|
51
51
|
# Will get restarted by ping worker.
|
52
|
-
|
52
|
+
rescue StandardError => e
|
53
|
+
client.logger.error(subtask.to_s) { e.message }
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
@@ -129,3 +130,5 @@ module Slack
|
|
129
130
|
end
|
130
131
|
end
|
131
132
|
end
|
133
|
+
|
134
|
+
raise "Incompatible version of async-websocket, #{Async::WebSocket::VERSION}, use \"gem 'async-websocket', '~> 0.8.0'\"." if Gem::Version.new(Async::WebSocket::VERSION) >= Gem::Version.new('0.9.0')
|
@@ -14,6 +14,16 @@ module Slack
|
|
14
14
|
|
15
15
|
### RealTime Events
|
16
16
|
|
17
|
+
# An enterprise grid migration has started on an external workspace..
|
18
|
+
# @see https://api.slack.com/events/external_org_migration_started
|
19
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/external_org_migration_started.json
|
20
|
+
# on :external_org_migration_started do |data|
|
21
|
+
|
22
|
+
# An enterprise grid migration has finished on an external workspace..
|
23
|
+
# @see https://api.slack.com/events/external_org_migration_finished
|
24
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/external_org_migration_finished.json
|
25
|
+
# on :external_org_migration_finished do |data|
|
26
|
+
|
17
27
|
# A private channel was deleted.
|
18
28
|
# @see https://api.slack.com/events/group_deleted
|
19
29
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_deleted.json
|
@@ -64,6 +64,16 @@ module Slack
|
|
64
64
|
|
65
65
|
### RealTime Events
|
66
66
|
|
67
|
+
# An enterprise grid migration has started on an external workspace..
|
68
|
+
# @see https://api.slack.com/events/external_org_migration_started
|
69
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/external_org_migration_started.json
|
70
|
+
# on :external_org_migration_started do |data|
|
71
|
+
|
72
|
+
# An enterprise grid migration has finished on an external workspace..
|
73
|
+
# @see https://api.slack.com/events/external_org_migration_finished
|
74
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/external_org_migration_finished.json
|
75
|
+
# on :external_org_migration_finished do |data|
|
76
|
+
|
67
77
|
# A private channel was deleted.
|
68
78
|
# @see https://api.slack.com/events/group_deleted
|
69
79
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_deleted.json
|
data/lib/slack/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# This file was auto-generated by lib/tasks/web.rake
|
2
2
|
|
3
|
+
require_relative 'endpoints/admin_users_session'
|
3
4
|
require_relative 'endpoints/api'
|
4
5
|
require_relative 'endpoints/apps'
|
5
6
|
require_relative 'endpoints/apps_permissions'
|
@@ -45,6 +46,7 @@ module Slack
|
|
45
46
|
include Slack::Web::Api::Mixins::Users
|
46
47
|
include Slack::Web::Api::Mixins::Groups
|
47
48
|
|
49
|
+
include AdminUsersSession
|
48
50
|
include Api
|
49
51
|
include Apps
|
50
52
|
include AppsPermissions
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module AdminUsersSession
|
8
|
+
#
|
9
|
+
# This method wipes a user session, leaving the user unauthenticated. The user's Slack client will reset its local cache.
|
10
|
+
#
|
11
|
+
# @option options [Object] :user_id
|
12
|
+
# The ID of the user to wipe sessions for.
|
13
|
+
# @option options [Object] :mobile_only
|
14
|
+
# Only expire mobile sessions (default: false).
|
15
|
+
# @option options [Object] :web_only
|
16
|
+
# Only expire web sessions (default: false).
|
17
|
+
# @see https://api.slack.com/methods/admin.users.session.reset
|
18
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.session/admin.users.session.reset.json
|
19
|
+
def admin_users_session_reset(options = {})
|
20
|
+
throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
|
21
|
+
post('admin.users.session.reset', options)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -6,7 +6,7 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Apps
|
8
8
|
#
|
9
|
-
# This method uninstalls
|
9
|
+
# This method uninstalls an app. Unlike auth.revoke, which revokes a single token, this method revokes all tokens associated with a single installation of an app.
|
10
10
|
#
|
11
11
|
# @option options [Object] :client_id
|
12
12
|
# Issued when you created your application.
|
@@ -93,6 +93,8 @@ module Slack
|
|
93
93
|
#
|
94
94
|
# This method posts an ephemeral message, which is visible only to the assigned user in a specific public channel, private channel, or private conversation.
|
95
95
|
#
|
96
|
+
# @option options [Object] :attachments
|
97
|
+
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
96
98
|
# @option options [channel] :channel
|
97
99
|
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
|
98
100
|
# @option options [Object] :text
|
@@ -101,16 +103,20 @@ module Slack
|
|
101
103
|
# id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
|
102
104
|
# @option options [Object] :as_user
|
103
105
|
# Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.
|
104
|
-
# @option options [Object] :attachments
|
105
|
-
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
106
106
|
# @option options [Object] :blocks
|
107
107
|
# A JSON-based array of structured blocks, presented as a URL-encoded string.
|
108
|
+
# @option options [Object] :icon_emoji
|
109
|
+
# Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
110
|
+
# @option options [Object] :icon_url
|
111
|
+
# URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
108
112
|
# @option options [Object] :link_names
|
109
113
|
# Find and link channel names and usernames.
|
110
114
|
# @option options [Object] :parse
|
111
115
|
# Change how messages are treated. Defaults to none. See below.
|
112
116
|
# @option options [Object] :thread_ts
|
113
117
|
# Provide another message's ts value to post this message in a thread. Avoid using a reply's ts value; use its parent's value instead. Ephemeral messages in threads are only shown if there is already an active thread.
|
118
|
+
# @option options [Object] :username
|
119
|
+
# Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
114
120
|
# @see https://api.slack.com/methods/chat.postEphemeral
|
115
121
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
|
116
122
|
def chat_postEphemeral(options = {})
|
@@ -6,7 +6,7 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Conversations
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# This method archives a conversation. Not all types of conversations can be archived.
|
10
10
|
#
|
11
11
|
# @option options [channel] :channel
|
12
12
|
# ID of conversation to archive.
|
@@ -19,7 +19,7 @@ module Slack
|
|
19
19
|
end
|
20
20
|
|
21
21
|
#
|
22
|
-
#
|
22
|
+
# This Conversations API method closes direct messages, multi-person or 1:1 or otherwise.
|
23
23
|
#
|
24
24
|
# @option options [channel] :channel
|
25
25
|
# Conversation to close.
|
@@ -32,7 +32,7 @@ module Slack
|
|
32
32
|
end
|
33
33
|
|
34
34
|
#
|
35
|
-
#
|
35
|
+
# Create a public or private channel using this Conversations API method.
|
36
36
|
#
|
37
37
|
# @option options [Object] :name
|
38
38
|
# Name of the public or private channel to create.
|
@@ -48,7 +48,7 @@ module Slack
|
|
48
48
|
end
|
49
49
|
|
50
50
|
#
|
51
|
-
#
|
51
|
+
# This method returns a portion of message events from the specified conversation.
|
52
52
|
#
|
53
53
|
# @option options [channel] :channel
|
54
54
|
# Conversation ID to fetch history for.
|
@@ -77,7 +77,7 @@ module Slack
|
|
77
77
|
end
|
78
78
|
|
79
79
|
#
|
80
|
-
#
|
80
|
+
# This Conversations API method returns information about a workspace conversation.
|
81
81
|
#
|
82
82
|
# @option options [channel] :channel
|
83
83
|
# Conversation ID to learn more about.
|
@@ -94,7 +94,7 @@ module Slack
|
|
94
94
|
end
|
95
95
|
|
96
96
|
#
|
97
|
-
#
|
97
|
+
# This Conversations API method invites 1-30 users to a public or private channel. The calling user must be a member of the channel.
|
98
98
|
#
|
99
99
|
# @option options [channel] :channel
|
100
100
|
# The ID of the public or private channel to invite user(s) to.
|
@@ -110,7 +110,7 @@ module Slack
|
|
110
110
|
end
|
111
111
|
|
112
112
|
#
|
113
|
-
#
|
113
|
+
# This Conversations API method joins a user to an existing conversation.
|
114
114
|
#
|
115
115
|
# @option options [channel] :channel
|
116
116
|
# ID of conversation to join.
|
@@ -123,7 +123,7 @@ module Slack
|
|
123
123
|
end
|
124
124
|
|
125
125
|
#
|
126
|
-
#
|
126
|
+
# This Conversations API method allows a user to remove another member from a channel.
|
127
127
|
#
|
128
128
|
# @option options [channel] :channel
|
129
129
|
# ID of conversation to remove user from.
|
@@ -140,7 +140,7 @@ module Slack
|
|
140
140
|
end
|
141
141
|
|
142
142
|
#
|
143
|
-
#
|
143
|
+
# This Conversations API method makes like a tree and leaves a conversation.
|
144
144
|
#
|
145
145
|
# @option options [channel] :channel
|
146
146
|
# Conversation to leave.
|
@@ -153,7 +153,7 @@ module Slack
|
|
153
153
|
end
|
154
154
|
|
155
155
|
#
|
156
|
-
#
|
156
|
+
# This Conversations API method returns a list of all channel-like conversations in a workspace. The "channels" returned depend on what the calling token has access to and the directives placed in the types parameter.
|
157
157
|
#
|
158
158
|
# @option options [Object] :cursor
|
159
159
|
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
|
@@ -176,7 +176,7 @@ module Slack
|
|
176
176
|
end
|
177
177
|
|
178
178
|
#
|
179
|
-
#
|
179
|
+
# This Conversations API method returns a paginated list of members party to a conversation.
|
180
180
|
#
|
181
181
|
# @option options [channel] :channel
|
182
182
|
# ID of the conversation to retrieve members for.
|
@@ -199,7 +199,7 @@ module Slack
|
|
199
199
|
end
|
200
200
|
|
201
201
|
#
|
202
|
-
#
|
202
|
+
# This Conversations API method opens a multi-person direct message or just a 1:1 direct message.
|
203
203
|
#
|
204
204
|
# @option options [channel] :channel
|
205
205
|
# Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead.
|
@@ -215,7 +215,7 @@ module Slack
|
|
215
215
|
end
|
216
216
|
|
217
217
|
#
|
218
|
-
#
|
218
|
+
# This method renames a conversation. Some types of conversations cannot be renamed.
|
219
219
|
#
|
220
220
|
# @option options [channel] :channel
|
221
221
|
# ID of conversation to rename.
|
@@ -231,7 +231,7 @@ module Slack
|
|
231
231
|
end
|
232
232
|
|
233
233
|
#
|
234
|
-
#
|
234
|
+
# This Conversations API method returns an entire thread (a message plus all the messages in reply to it), while conversations.history method returns only parent messages.
|
235
235
|
#
|
236
236
|
# @option options [channel] :channel
|
237
237
|
# Conversation ID to fetch thread from.
|
@@ -263,7 +263,7 @@ module Slack
|
|
263
263
|
end
|
264
264
|
|
265
265
|
#
|
266
|
-
#
|
266
|
+
# This method is used to change the purpose of a conversation. The calling user must be a member of the conversation. Not all conversation types may have a purpose set.
|
267
267
|
#
|
268
268
|
# @option options [channel] :channel
|
269
269
|
# Conversation to set the purpose of.
|
@@ -279,7 +279,7 @@ module Slack
|
|
279
279
|
end
|
280
280
|
|
281
281
|
#
|
282
|
-
#
|
282
|
+
# This method is used to change the topic of a conversation. The calling user must be a member of the conversation. Not all conversation types support a new topic.
|
283
283
|
#
|
284
284
|
# @option options [channel] :channel
|
285
285
|
# Conversation to set the topic of.
|
@@ -295,7 +295,7 @@ module Slack
|
|
295
295
|
end
|
296
296
|
|
297
297
|
#
|
298
|
-
#
|
298
|
+
# This method unarchives a conversation. The calling user is added to the conversation.
|
299
299
|
#
|
300
300
|
# @option options [channel] :channel
|
301
301
|
# ID of conversation to unarchive.
|
@@ -55,6 +55,7 @@ module Slack
|
|
55
55
|
# @see https://api.slack.com/methods/dnd.teamInfo
|
56
56
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.teamInfo.json
|
57
57
|
def dnd_teamInfo(options = {})
|
58
|
+
throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
|
58
59
|
post('dnd.teamInfo', options)
|
59
60
|
end
|
60
61
|
end
|
@@ -34,6 +34,10 @@ module Slack
|
|
34
34
|
|
35
35
|
#
|
36
36
|
# This method takes an existing private channel and performs the following steps:
|
37
|
+
# - Renames the existing private channel (from "example" to "example-archived").
|
38
|
+
# - Archives the existing private channel.
|
39
|
+
# - Creates a new private channel with the name of the existing private channel.
|
40
|
+
# - Adds all members of the existing private channel to the new private channel.
|
37
41
|
#
|
38
42
|
# @option options [group] :channel
|
39
43
|
# Private channel to clone and archive.
|
@@ -6,8 +6,8 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Pins
|
8
8
|
#
|
9
|
-
# This method pins
|
10
|
-
# The channel argument is required and
|
9
|
+
# This method pins a channel message or group message to a particular channel.
|
10
|
+
# The channel argument is required and timestamp must also be specified.
|
11
11
|
#
|
12
12
|
# @option options [channel] :channel
|
13
13
|
# Channel to pin the item in.
|
@@ -32,6 +32,8 @@ module Slack
|
|
32
32
|
#
|
33
33
|
# This method provides information about your team.
|
34
34
|
#
|
35
|
+
# @option options [Object] :team
|
36
|
+
# Team to get info on, if omitted, will return information about the current team. Will only return team that the authenticated token is allowed to see through external shared channels.
|
35
37
|
# @see https://api.slack.com/methods/team.info
|
36
38
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/team/team.info.json
|
37
39
|
def team_info(options = {})
|
@@ -6,7 +6,11 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Users
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# This method helps answer questions like:
|
10
|
+
# - Which conversations am I a member of?
|
11
|
+
# - Which public channels is my bot user in?
|
12
|
+
# - Do I have any direct messages open with my friend Suzy?
|
13
|
+
# - Is my bot a member of any private channels?
|
10
14
|
#
|
11
15
|
# @option options [Object] :cursor
|
12
16
|
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
|
@@ -1,10 +1,12 @@
|
|
1
|
-
diff --git a/
|
2
|
-
index
|
1
|
+
diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
|
2
|
+
index e1c409d..3b24fea 100644
|
3
3
|
--- a/lib/slack/web/api/endpoints/chat.rb
|
4
4
|
+++ b/lib/slack/web/api/endpoints/chat.rb
|
5
|
-
@@ -
|
5
|
+
@@ -120,9 +120,8 @@ module Slack
|
6
|
+
# @see https://api.slack.com/methods/chat.postEphemeral
|
6
7
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
|
7
8
|
def chat_postEphemeral(options = {})
|
9
|
+
- throw ArgumentError.new('Required arguments :attachments missing') if options[:attachments].nil?
|
8
10
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
9
11
|
- throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
10
12
|
+ throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
|
@@ -86,6 +86,9 @@ RSpec.describe Slack::RealTime::Client do
|
|
86
86
|
it 'sets groups' do
|
87
87
|
expect(client.groups.count).to eq 1
|
88
88
|
end
|
89
|
+
it 'includes team name in to_s' do
|
90
|
+
expect(client.to_s).to eq "id=#{client.team.id}, name=#{client.team.name}, domain=#{client.team.domain}"
|
91
|
+
end
|
89
92
|
end
|
90
93
|
it 'uses web client to fetch url' do
|
91
94
|
expect(client.web_client).to be_a Slack::Web::Client
|
@@ -148,6 +151,20 @@ RSpec.describe Slack::RealTime::Client do
|
|
148
151
|
expect(socket).to receive(:restart_async)
|
149
152
|
client.run_ping!
|
150
153
|
end
|
154
|
+
[EOFError, Errno::ECONNRESET, Errno::EPIPE, Faraday::ClientError].each do |err|
|
155
|
+
context "raising #{err}" do
|
156
|
+
it 'does not terminate the ping worker' do
|
157
|
+
allow(socket).to receive(:time_since_last_message) { raise err }
|
158
|
+
expect(socket).to_not receive(:send_data)
|
159
|
+
client.run_ping!
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
describe 'to_s' do
|
166
|
+
it 'defaults to class instance' do
|
167
|
+
expect(client.to_s).to match(/^#<Slack::RealTime::Client:0x\h+>$/)
|
151
168
|
end
|
152
169
|
end
|
153
170
|
end
|
@@ -190,6 +207,9 @@ RSpec.describe Slack::RealTime::Client do
|
|
190
207
|
it 'no groups' do
|
191
208
|
expect(client.groups).to be_nil
|
192
209
|
end
|
210
|
+
it 'includes team name in to_s' do
|
211
|
+
expect(client.to_s).to eq "id=#{client.team.id}, name=#{client.team.name}, domain=#{client.team.domain}"
|
212
|
+
end
|
193
213
|
end
|
194
214
|
it 'uses web client to fetch url' do
|
195
215
|
expect(client.web_client).to be_a Slack::Web::Client
|
@@ -242,6 +262,11 @@ RSpec.describe Slack::RealTime::Client do
|
|
242
262
|
it 'team' do
|
243
263
|
expect(client.team).to be nil
|
244
264
|
end
|
265
|
+
describe 'to_s' do
|
266
|
+
it 'defaults to class instance' do
|
267
|
+
expect(client.to_s).to match(/^#<Slack::RealTime::Client:0x\h+>$/)
|
268
|
+
end
|
269
|
+
end
|
245
270
|
end
|
246
271
|
context 'client with defaults' do
|
247
272
|
let(:client) { Slack::RealTime::Client.new }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Slack::Web::Api::Endpoints::AdminUsersSession do
|
6
|
+
let(:client) { Slack::Web::Client.new }
|
7
|
+
context 'admin.users.session_reset' do
|
8
|
+
it 'requires user_id' do
|
9
|
+
expect { client.admin_users_session_reset }.to raise_error ArgumentError, /Required arguments :user_id missing/
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -9,4 +9,9 @@ RSpec.describe Slack::Web::Api::Endpoints::Dnd do
|
|
9
9
|
expect { client.dnd_setSnooze }.to raise_error ArgumentError, /Required arguments :num_minutes missing/
|
10
10
|
end
|
11
11
|
end
|
12
|
+
context 'dnd_teamInfo' do
|
13
|
+
it 'requires users' do
|
14
|
+
expect { client.dnd_teamInfo }.to raise_error ArgumentError, /Required arguments :users missing/
|
15
|
+
end
|
16
|
+
end
|
12
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -229,6 +229,7 @@ files:
|
|
229
229
|
- Rakefile
|
230
230
|
- UPGRADING.md
|
231
231
|
- bin/commands.rb
|
232
|
+
- bin/commands/admin_users_session.rb
|
232
233
|
- bin/commands/api.rb
|
233
234
|
- bin/commands/apps.rb
|
234
235
|
- bin/commands/apps_permissions.rb
|
@@ -321,6 +322,7 @@ files:
|
|
321
322
|
- lib/slack/real_time/stores/store.rb
|
322
323
|
- lib/slack/version.rb
|
323
324
|
- lib/slack/web/api/endpoints.rb
|
325
|
+
- lib/slack/web/api/endpoints/admin_users_session.rb
|
324
326
|
- lib/slack/web/api/endpoints/api.rb
|
325
327
|
- lib/slack/web/api/endpoints/apps.rb
|
326
328
|
- lib/slack/web/api/endpoints/apps_permissions.rb
|
@@ -434,6 +436,7 @@ files:
|
|
434
436
|
- spec/slack/real_time/store_spec.rb
|
435
437
|
- spec/slack/slack_spec.rb
|
436
438
|
- spec/slack/version_spec.rb
|
439
|
+
- spec/slack/web/api/endpoints/admin_users_session_spec.rb
|
437
440
|
- spec/slack/web/api/endpoints/api_spec.rb
|
438
441
|
- spec/slack/web/api/endpoints/apps_permissions_resources_spec.rb
|
439
442
|
- spec/slack/web/api/endpoints/apps_permissions_scopes_spec.rb
|
@@ -505,8 +508,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
505
508
|
- !ruby/object:Gem::Version
|
506
509
|
version: 1.3.6
|
507
510
|
requirements: []
|
508
|
-
|
509
|
-
rubygems_version: 2.7.6
|
511
|
+
rubygems_version: 3.0.3
|
510
512
|
signing_key:
|
511
513
|
specification_version: 4
|
512
514
|
summary: Slack Web and RealTime API client.
|
@@ -546,6 +548,7 @@ test_files:
|
|
546
548
|
- spec/slack/real_time/store_spec.rb
|
547
549
|
- spec/slack/slack_spec.rb
|
548
550
|
- spec/slack/version_spec.rb
|
551
|
+
- spec/slack/web/api/endpoints/admin_users_session_spec.rb
|
549
552
|
- spec/slack/web/api/endpoints/api_spec.rb
|
550
553
|
- spec/slack/web/api/endpoints/apps_permissions_resources_spec.rb
|
551
554
|
- spec/slack/web/api/endpoints/apps_permissions_scopes_spec.rb
|