slack-ruby-client 3.3.0 → 3.4.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.
- checksums.yaml +4 -4
- data/.github/workflows/danger-comment.yml +11 -2
- data/.github/workflows/danger.yml +10 -2
- data/.github/workflows/lint.yml +21 -8
- data/.github/workflows/release.yml +27 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +93 -1
- data/.spellcheck.txt +256 -0
- data/AGENTS.md +1 -1
- data/CHANGELOG.md +17 -0
- data/CONTRIBUTING.md +53 -62
- data/Gemfile +20 -4
- data/LICENSE.md +1 -1
- data/README.md +94 -104
- data/RELEASING.md +20 -58
- data/Rakefile +22 -0
- data/SECURITY.md +1 -1
- data/UPGRADING.md +39 -43
- data/benchmarks/events.rb +26 -0
- data/benchmarks/formatting.rb +17 -0
- data/benchmarks/support.rb +67 -0
- data/benchmarks/web_client.rb +28 -0
- data/bin/commands/admin_analytics_members.rb +39 -0
- data/bin/commands/admin_analytics_messages.rb +2 -2
- data/bin/commands/admin_analytics_slackbot.rb +33 -0
- data/bin/commands/admin_apps_permissions.rb +1 -1
- data/bin/commands/admin_conversations.rb +11 -1
- data/bin/commands/admin_slackbot_skills.rb +56 -0
- data/bin/commands/admin_users.rb +11 -2
- data/bin/commands/admin_users_access.rb +31 -0
- data/bin/commands/agents_conversations.rb +122 -0
- data/bin/commands/apps_managed_permissions.rb +2 -2
- data/bin/commands/chat.rb +1 -1
- data/bin/commands/pins.rb +1 -1
- data/bin/commands/slackLists_download.rb +1 -0
- data/bin/commands/slackLists_items.rb +1 -1
- data/bin/commands/slackbot_skills.rb +71 -0
- data/bin/commands/slackbot_skills_library.rb +29 -0
- data/bin/commands/team.rb +1 -0
- data/bin/commands/team_externalTeams.rb +1 -1
- data/examples/files_upload_v2/README.md +4 -3
- data/examples/oauth_v2/README.md +5 -4
- data/lib/slack/messages/formatting.rb +29 -20
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics_members.rb +66 -0
- data/lib/slack/web/api/endpoints/admin_analytics_messages.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics_slackbot.rb +54 -0
- data/lib/slack/web/api/endpoints/admin_apps_permissions.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_conversations.rb +16 -1
- data/lib/slack/web/api/endpoints/admin_slackbot_skills.rb +84 -0
- data/lib/slack/web/api/endpoints/admin_users.rb +13 -1
- data/lib/slack/web/api/endpoints/admin_users_access.rb +40 -0
- data/lib/slack/web/api/endpoints/agents_conversations.rb +186 -0
- data/lib/slack/web/api/endpoints/apps_managed_permissions.rb +1 -1
- data/lib/slack/web/api/endpoints/chat.rb +1 -1
- data/lib/slack/web/api/endpoints/pins.rb +1 -1
- data/lib/slack/web/api/endpoints/slackLists_download.rb +2 -0
- data/lib/slack/web/api/endpoints/slackLists_items.rb +1 -1
- data/lib/slack/web/api/endpoints/slackbot_skills.rb +107 -0
- data/lib/slack/web/api/endpoints/slackbot_skills_library.rb +36 -0
- data/lib/slack/web/api/endpoints/team.rb +2 -0
- data/lib/slack/web/api/endpoints/team_externalTeams.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +14 -0
- data/lib/slack/web/api/errors.rb +258 -2
- data/lib/slack/web/api/mixins/ids.id.rb +2 -1
- data/script/release.rb +33 -0
- data/slack-ruby-client.gemspec +1 -2
- metadata +24 -3
data/CONTRIBUTING.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Contributing to Slack-Ruby-Client
|
|
2
2
|
|
|
3
|
-
This project is work of [many contributors](https://github.com/slack-ruby/slack-ruby-client/graphs/contributors).
|
|
3
|
+
This project is the work of [many contributors](https://github.com/slack-ruby/slack-ruby-client/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/slack-ruby/slack-ruby-client/pulls) and to [propose features and discuss issues](https://github.com/slack-ruby/slack-ruby-client/issues).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
In the examples below, substitute your GitHub username for `contributor` in URLs.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Set Up
|
|
8
8
|
|
|
9
9
|
### Fork the Project
|
|
10
10
|
|
|
11
|
-
Fork the [project on
|
|
11
|
+
Fork the [project on GitHub](https://github.com/slack-ruby/slack-ruby-client) and check out your copy.
|
|
12
12
|
|
|
13
|
-
```
|
|
13
|
+
```bash
|
|
14
14
|
git clone https://github.com/contributor/slack-ruby-client.git
|
|
15
15
|
cd slack-ruby-client
|
|
16
16
|
git remote add upstream https://github.com/slack-ruby/slack-ruby-client.git
|
|
@@ -18,16 +18,16 @@ git remote add upstream https://github.com/slack-ruby/slack-ruby-client.git
|
|
|
18
18
|
|
|
19
19
|
### Bundle Install and Test
|
|
20
20
|
|
|
21
|
-
Ensure that you can build the project and run tests.
|
|
21
|
+
Ensure that you can build the project and run tests. The gem supports Ruby 2.7 and newer.
|
|
22
22
|
|
|
23
|
-
```
|
|
23
|
+
```bash
|
|
24
24
|
bundle install
|
|
25
25
|
bundle exec rake
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### Run Examples in Development
|
|
29
29
|
|
|
30
|
-
Sign up for Slack, create a private Slack
|
|
30
|
+
Sign up for Slack, create a private Slack workspace for yourself, then [create an app and obtain a token](https://docs.slack.dev/authentication/tokens/). To get a token, install the app in a workspace and use the "User OAuth Token" from the installed app settings.
|
|
31
31
|
|
|
32
32
|
Try running the examples in the [examples](examples) directory.
|
|
33
33
|
|
|
@@ -41,9 +41,9 @@ SLACK_API_TOKEN=... bundle exec ruby hi.rb
|
|
|
41
41
|
|
|
42
42
|
### Create a Topic Branch
|
|
43
43
|
|
|
44
|
-
Make sure your fork is up
|
|
44
|
+
Make sure your fork is up to date and create a topic branch for your feature or bug fix.
|
|
45
45
|
|
|
46
|
-
```
|
|
46
|
+
```bash
|
|
47
47
|
git checkout master
|
|
48
48
|
git pull upstream master
|
|
49
49
|
git checkout -b my-feature-branch
|
|
@@ -59,122 +59,113 @@ We definitely appreciate pull requests that highlight or reproduce a problem, ev
|
|
|
59
59
|
|
|
60
60
|
Implement your feature or bug fix.
|
|
61
61
|
|
|
62
|
-
Ruby style
|
|
62
|
+
Ruby style, Markdown, YAML, and spelling are enforced with [RuboCop](https://github.com/rubocop/rubocop), including [exception message conventions](https://github.com/dblock/rubocop-exception_messages), [rubocop-md](https://github.com/rubocop/rubocop-md), [rubocop-prose](https://github.com/dblock/rubocop-prose), [rubocop-spellcheck](https://github.com/dblock/rubocop-spellcheck), and [rubocop-yaml](https://github.com/dblock/rubocop-yaml). The main Gemfile includes lint dependencies only on Ruby 3.2 and newer so tests can continue running on older supported Ruby versions.
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
bundle install
|
|
66
|
-
bundle exec
|
|
66
|
+
bundle exec rake lint
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Fix any style issues highlighted, auto-correcting safe issues with `bundle exec rubocop -a`. Exception message corrections require `-A`; review them and update message expectations in tests. To regenerate the baseline for generally ignored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
|
|
69
|
+
Fix any style issues highlighted, auto-correcting safe issues with `bundle exec rubocop -a`. Exception message corrections require `-A`; review them and update message expectations in tests. Add reviewed project vocabulary, such as API names and contributor handles, to [.spellcheck.txt](.spellcheck.txt) rather than disabling spelling checks. To regenerate the baseline for generally ignored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
|
|
70
|
+
|
|
71
|
+
The default `bundle exec rake` runs tests only. CI runs lint separately on Ruby 4.0.
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
### Run Benchmarks
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
Benchmarks in [benchmarks](benchmarks) measure iterations per second and allocations with [benchmark-ips](https://github.com/evanphx/benchmark-ips) and [benchmark-memory](https://github.com/michaelherold/benchmark-memory). Web client benchmarks answer requests in process with canned JSON, so they measure the client stack without network latency. Run them before and after a performance change and include the results in your pull request.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
bundle exec rake benchmark
|
|
79
|
+
bundle exec ruby benchmarks/formatting.rb
|
|
80
|
+
BENCHMARK_TIME=5 bundle exec ruby benchmarks/web_client.rb
|
|
81
|
+
```
|
|
74
82
|
|
|
75
83
|
### Write Documentation
|
|
76
84
|
|
|
77
|
-
Document any external behavior in the [README](README.md).
|
|
85
|
+
Document any external behavior in the [README](README.md). Keep each Markdown paragraph on a single line.
|
|
78
86
|
|
|
79
87
|
### Update Changelog
|
|
80
88
|
|
|
81
|
-
Add a line to [CHANGELOG](CHANGELOG.md) under
|
|
89
|
+
Add a line to [CHANGELOG](CHANGELOG.md) under the `(Next)` release, above `* Your contribution here.`, which must not be removed. Make it look like every other line, including a link to the pull request, your name, and a link to your GitHub account.
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
* [#123](https://github.com/slack-ruby/slack-ruby-client/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
|
93
|
+
```
|
|
82
94
|
|
|
83
|
-
|
|
95
|
+
If you don't know the pull request number yet, open the pull request first, then amend the entry.
|
|
84
96
|
|
|
85
97
|
### Commit Changes
|
|
86
98
|
|
|
87
|
-
Make sure
|
|
99
|
+
Make sure Git knows your name and email address.
|
|
88
100
|
|
|
89
|
-
```
|
|
101
|
+
```bash
|
|
90
102
|
git config --global user.name "Your Name"
|
|
91
103
|
git config --global user.email "contributor@example.com"
|
|
92
104
|
```
|
|
93
105
|
|
|
94
106
|
Writing good commit logs is important. A commit log should describe what changed and why.
|
|
95
107
|
|
|
96
|
-
```
|
|
108
|
+
```bash
|
|
97
109
|
git add ...
|
|
98
110
|
git commit
|
|
99
111
|
```
|
|
100
112
|
|
|
101
113
|
### Push
|
|
102
114
|
|
|
103
|
-
```
|
|
115
|
+
```bash
|
|
104
116
|
git push origin my-feature-branch
|
|
105
117
|
```
|
|
106
118
|
|
|
107
119
|
### Make a Pull Request
|
|
108
120
|
|
|
109
|
-
Go to https://github.com/contributor/slack-ruby-client
|
|
110
|
-
|
|
111
|
-
### Update CHANGELOG Again
|
|
112
|
-
|
|
113
|
-
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
* [#123](https://github.com/slack-ruby/slack-ruby-client/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Amend your previous commit and force push the changes.
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
git commit --amend
|
|
123
|
-
git push origin my-feature-branch -f
|
|
124
|
-
```
|
|
121
|
+
Go to `https://github.com/contributor/slack-ruby-client`, select your feature branch, and click the "Pull Request" button. Pull requests are usually reviewed within a few days.
|
|
125
122
|
|
|
126
123
|
### Rebase
|
|
127
124
|
|
|
128
|
-
If you've been working on a change for a while, rebase
|
|
125
|
+
If you've been working on a change for a while, rebase on `upstream/master` and amend your commit as needed.
|
|
129
126
|
|
|
130
|
-
```
|
|
127
|
+
```bash
|
|
131
128
|
git fetch upstream
|
|
132
129
|
git rebase upstream/master
|
|
133
|
-
git push origin my-feature-branch -
|
|
130
|
+
git push origin my-feature-branch --force-with-lease
|
|
134
131
|
```
|
|
135
132
|
|
|
136
133
|
### Check on Your Pull Request
|
|
137
134
|
|
|
138
|
-
Go back to your pull request after a few minutes and
|
|
135
|
+
Go back to your pull request after a few minutes and check whether it passed CI. Everything should look green; otherwise, fix the issues and amend your commit as described above. Danger checks the changelog and the README table of contents and comments on the pull request when it finds problems.
|
|
139
136
|
|
|
140
137
|
### Be Patient
|
|
141
138
|
|
|
142
|
-
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang
|
|
143
|
-
While you wait you can help with keeping the Slack Web API up to date, see [below](#update-slack-web-api).
|
|
139
|
+
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang in there! While you wait, you can help keep the Slack Web API up to date, see [below](#update-slack-web-api).
|
|
144
140
|
|
|
145
|
-
|
|
141
|
+
## Update Slack Web API
|
|
146
142
|
|
|
147
143
|
Please make sure to [create a separate branch](#create-a-topic-branch) for your changes.
|
|
148
144
|
|
|
149
|
-
Slack Web API is
|
|
145
|
+
The Slack Web API is generated from [slack-api-ref](https://github.com/slack-ruby/slack-api-ref), a maintained, machine-readable version of the Slack API documentation. The [Update API](.github/workflows/update_api.yml) workflow runs this weekly and opens a pull request. To update the Web API from the latest definition locally, run the following Rake task.
|
|
150
146
|
|
|
151
|
-
```
|
|
147
|
+
```bash
|
|
152
148
|
bundle exec rake slack:api:update
|
|
153
149
|
```
|
|
154
150
|
|
|
155
|
-
|
|
151
|
+
### Patching Slack Web API
|
|
156
152
|
|
|
157
153
|
Sometimes it's necessary to patch auto-generated Slack Web API methods. For example, we want to help clients with calling `to_json` on the `attachments` parameter sent to `chat_postMessage`. See [#20](https://github.com/slack-ruby/slack-ruby-client/issues/20).
|
|
158
154
|
|
|
159
155
|
The broad steps are:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
- This may add new methods if the API has updated, please split them up into multiple PRs if so.
|
|
156
|
+
|
|
157
|
+
1. Run `bundle exec rake slack:api:update` to check that existing patches are still valid. If you run into a `failed to apply patch` error, the auto-generated methods likely drifted from the last patch; follow the steps [below](#resolving-patch-errors). This may add new methods if the API has been updated; if so, please split them into separate pull requests.
|
|
163
158
|
2. Make a change to a generated file, for example `lib/slack/web/api/endpoints/chat.rb`.
|
|
164
|
-
3. Generate a patch
|
|
165
|
-
|
|
166
|
-
git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.added-support.patch
|
|
167
|
-
```
|
|
168
|
-
4. Run `rake slack:api:update` to ensure that the patch is cleanly applied. Implement a test for the added or modified functionality and commit the patch file.
|
|
159
|
+
3. Generate a patch with `git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.added-support.patch`.
|
|
160
|
+
4. Run `bundle exec rake slack:api:update` to ensure that the patch is cleanly applied. Implement a test for the added or modified functionality and commit the patch file.
|
|
169
161
|
|
|
170
|
-
|
|
162
|
+
### Resolving Patch Errors
|
|
171
163
|
|
|
172
|
-
The auto-generated method files may drift
|
|
173
|
-
1. Run `rake slack:api:update SKIP_PATCH=true` to create the raw auto-generated files. Commit the files that you are updating, so we can run `git diff` later.
|
|
174
|
-
2. Go through the old patches for the files (e.g. in `lib/slack/web/api/patches/chat.added-support.patch`), copying code into the new files.
|
|
175
|
-
- Run `git apply --reject path/to/patch-file.patch` to see hunks that couldn't be applied.
|
|
176
|
-
3. Continue with Step 2 [above](#patching-slack-web-api).
|
|
164
|
+
The auto-generated method files may drift over time, e.g. new arguments may be added or descriptions changed. Since previous patches were based on the older auto-generated files, Git may be unable to apply them to the new files. Resolving them requires some good ol' splicing:
|
|
177
165
|
|
|
166
|
+
1. Run `bundle exec rake slack:api:update SKIP_PATCH=true` to create the raw auto-generated files. Commit the files that you are updating, so you can run `git diff` later.
|
|
167
|
+
2. Go through the old patches for the files (e.g. `lib/slack/web/api/patches/chat.added-support.patch`), copying code into the new files. Run `git apply --reject path/to/patch-file.patch` to see hunks that couldn't be applied.
|
|
168
|
+
3. Continue with step 2 [above](#patching-slack-web-api).
|
|
178
169
|
|
|
179
170
|
## Thank You
|
|
180
171
|
|
data/Gemfile
CHANGED
|
@@ -30,12 +30,28 @@ group :test do
|
|
|
30
30
|
gem 'webrick', '~> 1.8'
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
group :benchmark do
|
|
34
|
+
gem 'benchmark-ips', '~> 2.15', require: false
|
|
35
|
+
gem 'benchmark-memory', '~> 0.2', require: false
|
|
36
|
+
end
|
|
37
|
+
|
|
33
38
|
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.2')
|
|
34
39
|
group :lint do
|
|
35
|
-
gem 'rubocop', '~> 1.
|
|
40
|
+
gem 'rubocop', '~> 1.92'
|
|
36
41
|
gem 'rubocop-exception_messages', '~> 0.2.0', require: false
|
|
37
|
-
gem 'rubocop-
|
|
38
|
-
gem 'rubocop-
|
|
39
|
-
gem 'rubocop-
|
|
42
|
+
gem 'rubocop-md', '~> 3.0', require: false
|
|
43
|
+
gem 'rubocop-performance', '~> 1.27', require: false
|
|
44
|
+
gem 'rubocop-prose', '~> 0.2', require: false
|
|
45
|
+
gem 'rubocop-rake', '~> 0.7', require: false
|
|
46
|
+
gem 'rubocop-rspec', '~> 3.10', require: false
|
|
47
|
+
gem 'rubocop-spellcheck', '~> 0.2', require: false
|
|
48
|
+
gem 'rubocop-yaml', '~> 0.1.0', require: false
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3')
|
|
53
|
+
group :development do
|
|
54
|
+
gem 'commonmarker', '~> 2.10', require: false
|
|
55
|
+
gem 'ruby-gem-release', '0.9.0', require: false
|
|
40
56
|
end
|
|
41
57
|
end
|
data/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2015-
|
|
3
|
+
Copyright (c) 2015-2026 Daniel Doubrovkine, Artsy and Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|