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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +9 -2
  4. data/.rubocop_todo.yml +52 -12
  5. data/.travis.yml +0 -1
  6. data/CHANGELOG.md +10 -0
  7. data/CONTRIBUTING.md +24 -6
  8. data/Dangerfile +1 -1
  9. data/Gemfile +1 -2
  10. data/README.md +20 -1
  11. data/UPGRADING.md +6 -0
  12. data/bin/commands.rb +5 -0
  13. data/bin/commands/admin_conversations.rb +1 -1
  14. data/bin/commands/admin_conversations_restrictAccess.rb +37 -0
  15. data/bin/commands/admin_conversations_whitelist.rb +37 -0
  16. data/bin/commands/admin_usergroups.rb +48 -0
  17. data/bin/commands/calls.rb +52 -0
  18. data/bin/commands/calls_participants.rb +25 -0
  19. data/bin/commands/chat.rb +5 -5
  20. data/bin/commands/conversations.rb +0 -1
  21. data/lib/slack-ruby-client.rb +2 -4
  22. data/lib/slack/messages/message.rb +0 -4
  23. data/lib/slack/real_time/concurrency/async.rb +1 -3
  24. data/lib/slack/real_time/concurrency/eventmachine.rb +3 -3
  25. data/lib/slack/real_time/models/base.rb +0 -4
  26. data/lib/slack/real_time/socket.rb +2 -2
  27. data/lib/slack/real_time/stores/base.rb +3 -1
  28. data/lib/slack/version.rb +1 -1
  29. data/lib/slack/web/api/endpoints.rb +11 -0
  30. data/lib/slack/web/api/endpoints/admin_conversations.rb +1 -1
  31. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
  32. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
  33. data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
  34. data/lib/slack/web/api/endpoints/calls.rb +83 -0
  35. data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
  36. data/lib/slack/web/api/endpoints/channels.rb +28 -13
  37. data/lib/slack/web/api/endpoints/chat.rb +12 -12
  38. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +1 -1
  39. data/lib/slack/web/api/endpoints/conversations.rb +15 -17
  40. data/lib/slack/web/api/endpoints/files.rb +2 -2
  41. data/lib/slack/web/api/endpoints/files_remote.rb +1 -1
  42. data/lib/slack/web/api/endpoints/groups.rb +16 -0
  43. data/lib/slack/web/api/endpoints/im.rb +10 -4
  44. data/lib/slack/web/api/endpoints/mpim.rb +10 -4
  45. data/lib/slack/web/api/endpoints/oauth.rb +0 -3
  46. data/lib/slack/web/api/endpoints/pins.rb +3 -3
  47. data/lib/slack/web/api/endpoints/reactions.rb +3 -3
  48. data/lib/slack/web/api/endpoints/stars.rb +2 -2
  49. data/lib/slack/web/api/errors.rb +92 -2
  50. data/lib/slack/web/api/mixins.rb +1 -0
  51. data/lib/slack/web/api/mixins/conversations.id.rb +27 -0
  52. data/lib/slack/web/api/mixins/ids.id.rb +1 -3
  53. data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +29 -26
  54. data/lib/slack/web/api/templates/method.erb +4 -1
  55. data/lib/slack/web/faraday/connection.rb +23 -20
  56. data/lib/slack/web/pagination/cursor.rb +2 -2
  57. data/slack-ruby-client.gemspec +5 -5
  58. data/spec/fixtures/slack/web/channels_info.yml +108 -15
  59. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
  60. data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +32 -0
  61. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
  62. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +24 -0
  63. data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
  64. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +3 -3
  65. data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -11
  66. data/spec/slack/web/api/errors/service_unavailable_spec.rb +2 -2
  67. data/spec/slack/web/api/mixins/conversations_spec.rb +41 -0
  68. data/spec/slack/web/client_spec.rb +26 -0
  69. metadata +49 -30
  70. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +0 -13
  71. data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
  72. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -21
  73. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
  74. 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