Skip to content

Commit 2995885

Browse files
authored
Rename files_upload_external to files_upload_v2 (#536)
1 parent 3a2277a commit 2995885

File tree

7 files changed

+11
-10
lines changed

7 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [#528](https://github.com/slack-ruby/slack-ruby-client/pull/528): Don't treat asterisks in list items as italic in markdown - [@rspeicher](https://github.com/rspeicher).
66
* [#530](https://github.com/slack-ruby/slack-ruby-client/pull/530): Specify dependency on logger - [@rwstauner](https://github.com/rwstauner).
77
* [#533](https://github.com/slack-ruby/slack-ruby-client/pull/533): Added `files_upload_external` - [@gregsaab](https://github.com/gregsaab).
8+
* [#536](https://github.com/slack-ruby/slack-ruby-client/pull/536): Rename `files_upload_external` to `files_upload_v2` - [@gregsaab](https://github.com/gregsaab).
89
* Your contribution here.
910

1011
### 2.4.0 (2024/07/14)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ general_channel = channels.detect { |c| c.name == 'general' }
173173

174174
Upload files with [sequenced API calls](https://api.slack.com/messaging/files#uploading_files).
175175

176-
This library provides a helper method `files_upload_external` that wraps the three separate API calls.
176+
This library provides a helper method `files_upload_v2` that wraps the three separate API calls.
177177

178178
```ruby
179-
client.files_upload_external(
179+
client.files_upload_v2(
180180
# required options
181181
channels: 'C000000,C000001', # comma delimited channel ids, only one channel is required
182182
filename: 'results.pdf', # this is used for the file title, unless a :title option is provided

lib/slack/web/api/helpers/files.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module Files
2727
# Provide another message's ts value to upload this file as a reply.
2828
# Never use a reply's ts value; use its parent instead.
2929
# Also make sure to provide only one channel when using 'thread_ts'.
30-
def files_upload_external(options = {})
30+
def files_upload_v2(options = {})
3131
%i[filename content channels].each do |param|
3232
raise ArgumentError, "Required argument :#{param} missing" if options[param].nil?
3333
end
File renamed without changes.

spec/fixtures/slack/web/files_upload_external_with_all_options.yml renamed to spec/fixtures/slack/web/files_upload_v2_with_all_options.yml

File renamed without changes.

spec/fixtures/slack/web/files_upload_external_with_channels_list.yml renamed to spec/fixtures/slack/web/files_upload_v2_with_channels_list.yml

File renamed without changes.

spec/slack/web/api/endpoints/custom_specs/files_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,35 @@
2020

2121
it 'raises an argument error' do
2222
expect do
23-
client.files_upload_external(params)
23+
client.files_upload_v2(params)
2424
end.to raise_error ArgumentError, /Required argument :#{arg} missing/
2525
end
2626
end
2727
end
2828

29-
context 'when all required options are sent', vcr: { cassette_name: 'web/files_upload_external' } do
29+
context 'when all required options are sent', vcr: { cassette_name: 'web/files_upload_v2' } do
3030
it 'completes the upload' do
31-
expect(client.files_upload_external(
31+
expect(client.files_upload_v2(
3232
filename: 'test.txt',
3333
content: 'Test File Contents',
3434
channels: 'C08AZ76CA4V'
3535
).files.size).to eq 1
3636
end
3737
end
3838

39-
context 'when using a list for channels', vcr: { cassette_name: 'web/files_upload_external_with_channels_list' } do
39+
context 'when using a list for channels', vcr: { cassette_name: 'web/files_upload_v2_with_channels_list' } do
4040
it 'completes the upload' do
41-
expect(client.files_upload_external(
41+
expect(client.files_upload_v2(
4242
filename: 'test.txt',
4343
content: 'Test File Contents',
4444
channels: 'C08AZ76CA4V,C08BHPZBZ8A'
4545
).files.size).to eq 1
4646
end
4747
end
4848

49-
context 'when all options specified', vcr: { cassette_name: 'web/files_upload_external_with_all_options' } do
49+
context 'when all options specified', vcr: { cassette_name: 'web/files_upload_v2_with_all_options' } do
5050
it 'completes the upload' do
51-
expect(client.files_upload_external(
51+
expect(client.files_upload_v2(
5252
title: 'title',
5353
filename: 'test.txt',
5454
content: 'Test File Contents',

0 commit comments

Comments
 (0)