slack-ruby-client 0.14.6 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.rubocop.yml +9 -2
- data/.rubocop_todo.yml +52 -12
- data/.travis.yml +0 -1
- data/CHANGELOG.md +10 -0
- data/CONTRIBUTING.md +24 -6
- data/Dangerfile +1 -1
- data/Gemfile +1 -2
- data/README.md +20 -1
- data/UPGRADING.md +6 -0
- data/bin/commands.rb +5 -0
- data/bin/commands/admin_conversations.rb +1 -1
- data/bin/commands/admin_conversations_restrictAccess.rb +37 -0
- data/bin/commands/admin_conversations_whitelist.rb +37 -0
- data/bin/commands/admin_usergroups.rb +48 -0
- data/bin/commands/calls.rb +52 -0
- data/bin/commands/calls_participants.rb +25 -0
- data/bin/commands/chat.rb +5 -5
- data/bin/commands/conversations.rb +0 -1
- data/lib/slack-ruby-client.rb +2 -4
- data/lib/slack/messages/message.rb +0 -4
- data/lib/slack/real_time/concurrency/async.rb +1 -3
- data/lib/slack/real_time/concurrency/eventmachine.rb +3 -3
- data/lib/slack/real_time/models/base.rb +0 -4
- data/lib/slack/real_time/socket.rb +2 -2
- data/lib/slack/real_time/stores/base.rb +3 -1
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +11 -0
- data/lib/slack/web/api/endpoints/admin_conversations.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
- data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
- data/lib/slack/web/api/endpoints/calls.rb +83 -0
- data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
- data/lib/slack/web/api/endpoints/channels.rb +28 -13
- data/lib/slack/web/api/endpoints/chat.rb +12 -12
- data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +1 -1
- data/lib/slack/web/api/endpoints/conversations.rb +15 -17
- data/lib/slack/web/api/endpoints/files.rb +2 -2
- data/lib/slack/web/api/endpoints/files_remote.rb +1 -1
- data/lib/slack/web/api/endpoints/groups.rb +16 -0
- data/lib/slack/web/api/endpoints/im.rb +10 -4
- data/lib/slack/web/api/endpoints/mpim.rb +10 -4
- data/lib/slack/web/api/endpoints/oauth.rb +0 -3
- data/lib/slack/web/api/endpoints/pins.rb +3 -3
- data/lib/slack/web/api/endpoints/reactions.rb +3 -3
- data/lib/slack/web/api/endpoints/stars.rb +2 -2
- data/lib/slack/web/api/errors.rb +92 -2
- data/lib/slack/web/api/mixins.rb +1 -0
- data/lib/slack/web/api/mixins/conversations.id.rb +27 -0
- data/lib/slack/web/api/mixins/ids.id.rb +1 -3
- data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +29 -26
- data/lib/slack/web/api/templates/method.erb +4 -1
- data/lib/slack/web/faraday/connection.rb +23 -20
- data/lib/slack/web/pagination/cursor.rb +2 -2
- data/slack-ruby-client.gemspec +5 -5
- data/spec/fixtures/slack/web/channels_info.yml +108 -15
- data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
- data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +32 -0
- data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
- data/spec/slack/web/api/endpoints/calls_participants_spec.rb +24 -0
- data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
- data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +3 -3
- data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -11
- data/spec/slack/web/api/errors/service_unavailable_spec.rb +2 -2
- data/spec/slack/web/api/mixins/conversations_spec.rb +41 -0
- data/spec/slack/web/client_spec.rb +26 -0
- metadata +49 -30
- data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +0 -13
- data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
- data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -21
- data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
- data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +0 -15
@@ -1,13 +0,0 @@
|
|
1
|
-
diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
|
2
|
-
index 1f7a8d7..2ec4bed 100644
|
3
|
-
--- a/lib/slack/web/api/endpoints/chat.rb
|
4
|
-
+++ b/lib/slack/web/api/endpoints/chat.rb
|
5
|
-
@@ -49,7 +49,7 @@ module Slack
|
6
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
|
7
|
-
def chat_postMessage(options = {})
|
8
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
9
|
-
- throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
10
|
-
+ throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
|
11
|
-
post('chat.postMessage', options)
|
12
|
-
end
|
13
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
|
2
|
-
index 1f7a8d7..89b1562 100644
|
3
|
-
--- a/lib/slack/web/api/endpoints/chat.rb
|
4
|
-
+++ b/lib/slack/web/api/endpoints/chat.rb
|
5
|
-
@@ -50,6 +50,12 @@ module Slack
|
6
|
-
def chat_postMessage(options = {})
|
7
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
8
|
-
throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
|
9
|
-
+ # attachments must be passed as an encoded JSON string
|
10
|
-
+ if options.key?(:attachments)
|
11
|
-
+ attachments = options[:attachments]
|
12
|
-
+ attachments = JSON.dump(attachments) unless attachments.is_a?(String)
|
13
|
-
+ options = options.merge(attachments: attachments)
|
14
|
-
+ end
|
15
|
-
post('chat.postMessage', options)
|
16
|
-
end
|
17
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
|
2
|
-
index 5186416..490bc91 100644
|
3
|
-
--- a/lib/slack/web/api/endpoints/chat.rb
|
4
|
-
+++ b/lib/slack/web/api/endpoints/chat.rb
|
5
|
-
@@ -154,9 +154,15 @@ module Slack
|
6
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
|
7
|
-
def chat_update(options = {})
|
8
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
9
|
-
- throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
10
|
-
+ throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
|
11
|
-
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
12
|
-
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
13
|
-
+ # attachments must be passed as an encoded JSON string
|
14
|
-
+ if options.key?(:attachments)
|
15
|
-
+ attachments = options[:attachments]
|
16
|
-
+ attachments = JSON.dump(attachments) unless attachments.is_a?(String)
|
17
|
-
+ options = options.merge(attachments: attachments)
|
18
|
-
+ end
|
19
|
-
post('chat.update', options)
|
20
|
-
end
|
21
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
|
2
|
-
index 846126e..0c254c6 100644
|
3
|
-
--- a/lib/slack/web/api/endpoints/chat.rb
|
4
|
-
+++ b/lib/slack/web/api/endpoints/chat.rb
|
5
|
-
@@ -62,6 +62,12 @@ module Slack
|
6
|
-
throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
7
|
-
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
8
|
-
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
9
|
-
+ # attachments must be passed as an encoded JSON string
|
10
|
-
+ if options.key?(:attachments)
|
11
|
-
+ attachments = options[:attachments]
|
12
|
-
+ attachments = JSON.dump(attachments) unless attachments.is_a?(String)
|
13
|
-
+ options = options.merge(attachments: attachments)
|
14
|
-
+ end
|
15
|
-
post('chat.postEphemeral', options)
|
16
|
-
end
|
17
|
-
|
@@ -1,15 +0,0 @@
|
|
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
|
-
--- a/lib/slack/web/api/endpoints/chat.rb
|
4
|
-
+++ b/lib/slack/web/api/endpoints/chat.rb
|
5
|
-
@@ -120,9 +120,8 @@ module Slack
|
6
|
-
# @see https://api.slack.com/methods/chat.postEphemeral
|
7
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
|
8
|
-
def chat_postEphemeral(options = {})
|
9
|
-
- throw ArgumentError.new('Required arguments :attachments missing') if options[:attachments].nil?
|
10
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
11
|
-
- throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
12
|
-
+ throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
|
13
|
-
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
14
|
-
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
15
|
-
# attachments must be passed as an encoded JSON string
|