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,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative 'mixins/channels.id'
3
+ require_relative 'mixins/conversations.id'
3
4
  require_relative 'mixins/users.id'
4
5
  require_relative 'mixins/users.search'
5
6
  require_relative 'mixins/groups.id'
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ require_relative 'ids.id'
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Mixins
8
+ module Conversations
9
+ include Ids
10
+ #
11
+ # This method returns a channel ID given a channel name.
12
+ #
13
+ # @option options [channel] :channel
14
+ # Channel to get ID for, prefixed with #.
15
+ def conversations_id(options = {})
16
+ name = options[:channel]
17
+ throw ArgumentError.new('Required arguments :channel missing') if name.nil?
18
+
19
+ id_for(:channel, name, '#', :channels, 'channel_not_found') do
20
+ conversations_list
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -11,9 +11,7 @@ module Slack
11
11
 
12
12
  yield.tap do |list|
13
13
  list.public_send(list_method).each do |li|
14
- if li.name == name[1..-1]
15
- return Slack::Messages::Message.new('ok' => true, key.to_s => { 'id' => li.id })
16
- end
14
+ return Slack::Messages::Message.new('ok' => true, key.to_s => { 'id' => li.id }) if li.name == name[1..-1]
17
15
  end
18
16
  end
19
17
 
@@ -1,20 +1,23 @@
1
1
  diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
2
- index 54a7db1..c535bb5 100644
2
+ index 9de4aa9..8ed5625 100644
3
3
  --- a/lib/slack/web/api/endpoints/chat.rb
4
4
  +++ b/lib/slack/web/api/endpoints/chat.rb
5
- @@ -97,7 +97,7 @@ module Slack
5
+ @@ -121,11 +121,22 @@ 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
- - throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
11
+ - throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
10
12
  + throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
11
13
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
12
14
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
13
- # attachments must be passed as an encoded JSON string
14
- @@ -106,6 +106,12 @@ module Slack
15
- attachments = JSON.dump(attachments) unless attachments.is_a?(String)
16
- options = options.merge(attachments: attachments)
17
- end
15
+ + # attachments must be passed as an encoded JSON string
16
+ + if options.key?(:attachments)
17
+ + attachments = options[:attachments]
18
+ + attachments = JSON.dump(attachments) unless attachments.is_a?(String)
19
+ + options = options.merge(attachments: attachments)
20
+ + end
18
21
  + # blocks must be passed as an encoded JSON string
19
22
  + if options.key?(:blocks)
20
23
  + blocks = options[:blocks]
@@ -23,19 +26,19 @@ index 54a7db1..c535bb5 100644
23
26
  + end
24
27
  post('chat.postEphemeral', options)
25
28
  end
26
-
27
- @@ -146,13 +152,19 @@ module Slack
29
+
30
+ @@ -166,7 +177,19 @@ module Slack
28
31
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
29
32
  def chat_postMessage(options = {})
30
33
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
31
- - throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
34
+ - throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
32
35
  + throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
33
- # attachments must be passed as an encoded JSON string
34
- if options.key?(:attachments)
35
- attachments = options[:attachments]
36
- attachments = JSON.dump(attachments) unless attachments.is_a?(String)
37
- options = options.merge(attachments: attachments)
38
- end
36
+ + # attachments must be passed as an encoded JSON string
37
+ + if options.key?(:attachments)
38
+ + attachments = options[:attachments]
39
+ + attachments = JSON.dump(attachments) unless attachments.is_a?(String)
40
+ + options = options.merge(attachments: attachments)
41
+ + end
39
42
  + # blocks must be passed as an encoded JSON string
40
43
  + if options.key?(:blocks)
41
44
  + blocks = options[:blocks]
@@ -44,20 +47,20 @@ index 54a7db1..c535bb5 100644
44
47
  + end
45
48
  post('chat.postMessage', options)
46
49
  end
47
-
48
- @@ -204,7 +216,7 @@ module Slack
50
+
51
+ @@ -254,8 +277,21 @@ module Slack
49
52
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
50
53
  def chat_update(options = {})
51
54
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
52
- - throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
53
55
  + throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
54
56
  throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
55
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
56
- # attachments must be passed as an encoded JSON string
57
- @@ -213,6 +225,12 @@ module Slack
58
- attachments = JSON.dump(attachments) unless attachments.is_a?(String)
59
- options = options.merge(attachments: attachments)
60
- end
57
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
58
+ + # attachments must be passed as an encoded JSON string
59
+ + if options.key?(:attachments)
60
+ + attachments = options[:attachments]
61
+ + attachments = JSON.dump(attachments) unless attachments.is_a?(String)
62
+ + options = options.merge(attachments: attachments)
63
+ + end
61
64
  + # blocks must be passed as an encoded JSON string
62
65
  + if options.key?(:blocks)
63
66
  + blocks = options[:blocks]
@@ -40,7 +40,7 @@ module Slack
40
40
  <% if data['group'] == 'groups' && data['args']['channel'] && !data['args']['channel']['desc'].include?('Can be an encoded ID, or a name.') %>
41
41
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
42
42
  <% elsif data['args']['channel'] && !data['args']['channel']['desc'].include?('Can be an encoded ID, or a name.') %>
43
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
43
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
44
44
  <% end %>
45
45
  <% if data['args']['user'] %>
46
46
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
@@ -48,6 +48,9 @@ module Slack
48
48
  <% if data['undocumented'] %>
49
49
  logger.warn('The <%= group %>.<%= name %> method is undocumented.')
50
50
  <% end %>
51
+ <% if data['deprecated'] %>
52
+ logger.warn('<%= group %>.<%= name %>: <%= data['deprecation']['deprecation_warning']%> Alternative methods: <%= data['deprecation']['alternative_methods'].join(', ')%>.')
53
+ <% end %>
51
54
  <% if data['args'].keys.include?('cursor') %>
52
55
  if block_given?
53
56
  Pagination::Cursor.new(self, :<%= group.gsub(".", "_") %>_<%= name %>, options).each do |page|
@@ -6,29 +6,32 @@ module Slack
6
6
  private
7
7
 
8
8
  def connection
9
- options = {
10
- headers: { 'Accept' => 'application/json; charset=utf-8' }
11
- }
9
+ @connection ||=
10
+ begin
11
+ options = {
12
+ headers: { 'Accept' => 'application/json; charset=utf-8' }
13
+ }
12
14
 
13
- options[:headers]['User-Agent'] = user_agent if user_agent
14
- options[:proxy] = proxy if proxy
15
- options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file
15
+ options[:headers]['User-Agent'] = user_agent if user_agent
16
+ options[:proxy] = proxy if proxy
17
+ options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file
16
18
 
17
- request_options = {}
18
- request_options[:timeout] = timeout if timeout
19
- request_options[:open_timeout] = open_timeout if open_timeout
20
- options[:request] = request_options if request_options.any?
19
+ request_options = {}
20
+ request_options[:timeout] = timeout if timeout
21
+ request_options[:open_timeout] = open_timeout if open_timeout
22
+ options[:request] = request_options if request_options.any?
21
23
 
22
- ::Faraday::Connection.new(endpoint, options) do |connection|
23
- connection.use ::Faraday::Request::Multipart
24
- connection.use ::Faraday::Request::UrlEncoded
25
- connection.use ::Faraday::Response::RaiseError
26
- connection.use ::Slack::Web::Faraday::Response::RaiseError
27
- connection.use ::FaradayMiddleware::Mashify, mash_class: Slack::Messages::Message
28
- connection.use ::FaradayMiddleware::ParseJson
29
- connection.response :logger, logger if logger
30
- connection.adapter ::Faraday.default_adapter
31
- end
24
+ ::Faraday::Connection.new(endpoint, options) do |connection|
25
+ connection.use ::Faraday::Request::Multipart
26
+ connection.use ::Faraday::Request::UrlEncoded
27
+ connection.use ::Faraday::Response::RaiseError
28
+ connection.use ::Slack::Web::Faraday::Response::RaiseError
29
+ connection.use ::FaradayMiddleware::Mashify, mash_class: Slack::Messages::Message
30
+ connection.use ::FaradayMiddleware::ParseJson
31
+ connection.response :logger, logger if logger
32
+ connection.adapter ::Faraday.default_adapter
33
+ end
34
+ end
32
35
  end
33
36
  end
34
37
  end
@@ -32,14 +32,14 @@ module Slack
32
32
 
33
33
  client.logger.debug("#{self.class}##{__method__}") { e.to_s }
34
34
  retry_count += 1
35
- sleep(e.retry_after.seconds)
35
+ sleep(e.retry_after)
36
36
  next
37
37
  end
38
38
  yield response
39
39
  break unless response.response_metadata
40
40
 
41
41
  next_cursor = response.response_metadata.next_cursor
42
- break if next_cursor.blank?
42
+ break if next_cursor.nil? || next_cursor == ''
43
43
 
44
44
  retry_count = 0
45
45
  sleep(sleep_interval) if sleep_interval
@@ -17,19 +17,19 @@ Gem::Specification.new do |s|
17
17
  s.homepage = 'http://github.com/slack-ruby/slack-ruby-client'
18
18
  s.licenses = ['MIT']
19
19
  s.summary = 'Slack Web and RealTime API client.'
20
- s.add_dependency 'activesupport'
21
- s.add_dependency 'faraday', '>= 0.9'
20
+ s.add_dependency 'faraday', '>= 1.0'
22
21
  s.add_dependency 'faraday_middleware'
23
22
  s.add_dependency 'gli'
24
23
  s.add_dependency 'hashie'
25
24
  s.add_dependency 'websocket-driver'
25
+ s.add_development_dependency 'activesupport'
26
26
  s.add_development_dependency 'erubis'
27
27
  s.add_development_dependency 'json-schema'
28
28
  s.add_development_dependency 'rake', '~> 10'
29
29
  s.add_development_dependency 'rspec'
30
- s.add_development_dependency 'rubocop', '~> 0.73.0'
31
- s.add_development_dependency 'rubocop-performance', '~> 1.4.1'
32
- s.add_development_dependency 'rubocop-rspec', '~> 1.34.0'
30
+ s.add_development_dependency 'rubocop', '~> 0.82.0'
31
+ s.add_development_dependency 'rubocop-performance', '~> 1.5.2'
32
+ s.add_development_dependency 'rubocop-rspec', '~> 1.39.0'
33
33
  s.add_development_dependency 'timecop'
34
34
  s.add_development_dependency 'vcr'
35
35
  s.add_development_dependency 'webmock'
@@ -2,45 +2,138 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://slack.com/api/channels.list
5
+ uri: https://slack.com/api/conversations.list
6
6
  body:
7
7
  encoding: UTF-8
8
8
  string: token=token
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Client/0.15.0
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
9
18
  response:
10
19
  status:
11
20
  code: 200
12
21
  message: OK
13
22
  headers:
23
+ Date:
24
+ - Mon, 06 Jul 2020 14:21:41 GMT
25
+ Server:
26
+ - Apache
27
+ X-Slack-Req-Id:
28
+ - d6a36df98a9b67696d158d792698542b
29
+ X-Oauth-Scopes:
30
+ - channels:read
31
+ X-Accepted-Oauth-Scopes:
32
+ - channels:read,groups:read,mpim:read,im:read,read
33
+ Access-Control-Expose-Headers:
34
+ - x-slack-req-id, retry-after
35
+ X-Slack-Backend:
36
+ - r
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ Expires:
40
+ - Mon, 26 Jul 1997 05:00:00 GMT
41
+ Cache-Control:
42
+ - private, no-cache, no-store, must-revalidate
43
+ X-Xss-Protection:
44
+ - '0'
45
+ Vary:
46
+ - Accept-Encoding
47
+ Pragma:
48
+ - no-cache
49
+ Access-Control-Allow-Headers:
50
+ - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid,
51
+ x-b3-sampled, x-b3-flags
52
+ Strict-Transport-Security:
53
+ - max-age=31536000; includeSubDomains; preload
54
+ Referrer-Policy:
55
+ - no-referrer
56
+ Access-Control-Allow-Origin:
57
+ - "*"
58
+ Content-Length:
59
+ - '616'
14
60
  Content-Type:
15
61
  - application/json; charset=utf-8
62
+ X-Via:
63
+ - haproxy-www-xvqc,haproxy-edge-sin-605a
16
64
  body:
17
- encoding: UTF-8
18
- string: '{"ok":true,"channels":[{"id":"C04KB5X4D","name":"general","is_channel":true,"created":1430222230,"creator":"U04KB5WQR","is_archived":false,"is_general":true,"is_member":true,"last_read":"1435863302.000026","latest":{"type":"message","user":"U0HPMN0GY","text":"```\n{\"ok\":true,\"args\":{\"token\":\"xoxb-17803748576-H794PZkqOo4DkjYddb438F2J\"}}```","ts":"1452025068.000045"},"unread_count":321,"unread_count_display":283,"members":["U04JPQ0JS","U04JZBDQQ","U04KB5WQR"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This
19
- channel is for team-wide communication and announcements. All team members
20
- are in this channel.","creator":"","last_set":0}}]}'
21
- http_version:
22
- recorded_at: Fri, 22 Jan 2016 19:01:46 GMT
65
+ encoding: ASCII-8BIT
66
+ string: '{"ok":true,"channels":[{"id":"C016K3T7XK7","name":"random","is_channel":true,"is_group":false,"is_im":false,"created":1594044322,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"random","is_shared":false,"parent_conversation":null,"creator":"U016LEXAH5Y","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T016DNSRF7G"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"topic":{"value":"Non-work
67
+ banter and water cooler conversation","creator":"U016LEXAH5Y","last_set":1594044322},"purpose":{"value":"A
68
+ place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber
69
+ you''d prefer to keep out of more focused work-related channels.","creator":"U016LEXAH5Y","last_set":1594044322},"previous_names":[],"num_members":1},{"id":"C016Z3VRSSV","name":"general","is_channel":true,"is_group":false,"is_im":false,"created":1594044322,"is_archived":false,"is_general":true,"unlinked":0,"name_normalized":"general","is_shared":false,"parent_conversation":null,"creator":"U016LEXAH5Y","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T016DNSRF7G"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"topic":{"value":"Company-wide
70
+ announcements and work-based matters","creator":"U016LEXAH5Y","last_set":1594044322},"purpose":{"value":"This
71
+ channel is for workspace-wide communication and announcements. All members
72
+ are in this channel.","creator":"U016LEXAH5Y","last_set":1594044322},"previous_names":[],"num_members":1},{"id":"C017AA3CCDN","name":"slack-ruby-client","is_channel":true,"is_group":false,"is_im":false,"created":1594044322,"is_archived":false,"is_general":false,"unlinked":0,"name_normalized":"slack-ruby-client","is_shared":false,"parent_conversation":null,"creator":"U016LEXAH5Y","is_ext_shared":false,"is_org_shared":false,"shared_team_ids":["T016DNSRF7G"],"pending_shared":[],"pending_connected_team_ids":[],"is_pending_ext_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0},"previous_names":[],"num_members":1}],"response_metadata":{"next_cursor":""}}'
73
+ recorded_at: Mon, 06 Jul 2020 14:21:41 GMT
23
74
  - request:
24
75
  method: post
25
76
  uri: https://slack.com/api/channels.info
26
77
  body:
27
78
  encoding: UTF-8
28
- string: channel=C04KB5X4D&token=token
79
+ string: channel=C016Z3VRSSV&token=token
29
80
  headers:
81
+ Accept:
82
+ - application/json; charset=utf-8
83
+ User-Agent:
84
+ - Slack Ruby Client/0.15.0
30
85
  Content-Type:
31
86
  - application/x-www-form-urlencoded
87
+ Accept-Encoding:
88
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
32
89
  response:
33
90
  status:
34
91
  code: 200
35
92
  message: OK
36
93
  headers:
94
+ Date:
95
+ - Mon, 06 Jul 2020 14:21:42 GMT
96
+ Server:
97
+ - Apache
98
+ X-Content-Type-Options:
99
+ - nosniff
100
+ X-Slack-Req-Id:
101
+ - b7ad44601d7e0a60c5c68601e15c89c8
102
+ X-Oauth-Scopes:
103
+ - channels:read
104
+ Expires:
105
+ - Mon, 26 Jul 1997 05:00:00 GMT
106
+ Cache-Control:
107
+ - private, no-cache, no-store, must-revalidate
108
+ X-Xss-Protection:
109
+ - '0'
110
+ Vary:
111
+ - Accept-Encoding
112
+ Pragma:
113
+ - no-cache
114
+ Access-Control-Allow-Headers:
115
+ - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid,
116
+ x-b3-sampled, x-b3-flags
117
+ Strict-Transport-Security:
118
+ - max-age=31536000; includeSubDomains; preload
119
+ Referrer-Policy:
120
+ - no-referrer
121
+ X-Slack-Backend:
122
+ - r
123
+ Access-Control-Expose-Headers:
124
+ - x-slack-req-id, retry-after
125
+ Access-Control-Allow-Origin:
126
+ - "*"
127
+ Content-Length:
128
+ - '222'
37
129
  Content-Type:
38
130
  - application/json; charset=utf-8
131
+ X-Via:
132
+ - haproxy-www-nu22,haproxy-edge-sin-p1t0
39
133
  body:
40
- encoding: UTF-8
41
- string: '{"ok":true,"channel":{"id":"C04KB5X4D","name":"general","is_channel":true,"created":1430222230,"creator":"U04KB5WQR","is_archived":false,"is_general":true,"is_member":true,"last_read":"1435863302.000026","latest":{"type":"message","user":"U0HPMN0GY","text":"```\n{\"ok\":true,\"args\":{\"token\":\"xoxb-17803748576-H794PZkqOo4DkjYddb438F2J\"}}```","ts":"1452025068.000045"},"unread_count":321,"unread_count_display":283,"members":["U04JPQ0JS","U04JZBDQQ","U04KB5WQR","U06JGTU5V","U07518DTL","U07KECJ77","U092BDCLV","U092V4E9L","U0EA7TZJN","U0H701CJZ","U0HLFUZLJ","U0HPMN0GY"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This
42
- channel is for team-wide communication and announcements. All team members
43
- are in this channel.","creator":"","last_set":0}}}'
44
- http_version:
45
- recorded_at: Fri, 22 Jan 2016 19:01:46 GMT
46
- recorded_with: VCR 3.0.1
134
+ encoding: ASCII-8BIT
135
+ string: '{"ok":false,"error":"method_deprecated","response_metadata":{"messages":["[ERROR]
136
+ This method is retired and can no longer be used. Please use conversations.info
137
+ instead. Learn more: https:\/\/api.slack.com\/changelog\/2020-01-deprecating-antecedents-to-the-conversations-api."]}}'
138
+ recorded_at: Mon, 06 Jul 2020 14:21:42 GMT
139
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ require 'spec_helper'
5
+
6
+ RSpec.describe Slack::Web::Api::Endpoints::AdminConversationsRestrictaccess do
7
+ let(:client) { Slack::Web::Client.new }
8
+ context 'admin.conversations.restrictAccess_addGroup' do
9
+ it 'requires channel_id' do
10
+ expect { client.admin_conversations_restrictAccess_addGroup(group_id: '') }.to raise_error ArgumentError, /Required arguments :channel_id missing/
11
+ end
12
+ it 'requires group_id' do
13
+ expect { client.admin_conversations_restrictAccess_addGroup(channel_id: '') }.to raise_error ArgumentError, /Required arguments :group_id missing/
14
+ end
15
+ end
16
+ context 'admin.conversations.restrictAccess_listGroups' do
17
+ it 'requires channel_id' do
18
+ expect { client.admin_conversations_restrictAccess_listGroups }.to raise_error ArgumentError, /Required arguments :channel_id missing/
19
+ end
20
+ end
21
+ context 'admin.conversations.restrictAccess_removeGroup' do
22
+ it 'requires channel_id' do
23
+ expect { client.admin_conversations_restrictAccess_removeGroup(group_id: '', team_id: '') }.to raise_error ArgumentError, /Required arguments :channel_id missing/
24
+ end
25
+ it 'requires group_id' do
26
+ expect { client.admin_conversations_restrictAccess_removeGroup(channel_id: '', team_id: '') }.to raise_error ArgumentError, /Required arguments :group_id missing/
27
+ end
28
+ it 'requires team_id' do
29
+ expect { client.admin_conversations_restrictAccess_removeGroup(channel_id: '', group_id: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ require 'spec_helper'
5
+
6
+ RSpec.describe Slack::Web::Api::Endpoints::AdminConversationsWhitelist do
7
+ let(:client) { Slack::Web::Client.new }
8
+ context 'admin.conversations.whitelist_add' do
9
+ it 'requires channel_id' do
10
+ expect { client.admin_conversations_whitelist_add(group_id: '') }.to raise_error ArgumentError, /Required arguments :channel_id missing/
11
+ end
12
+ it 'requires group_id' do
13
+ expect { client.admin_conversations_whitelist_add(channel_id: '') }.to raise_error ArgumentError, /Required arguments :group_id missing/
14
+ end
15
+ end
16
+ context 'admin.conversations.whitelist_listGroupsLinkedToChannel' do
17
+ it 'requires channel_id' do
18
+ expect { client.admin_conversations_whitelist_listGroupsLinkedToChannel }.to raise_error ArgumentError, /Required arguments :channel_id missing/
19
+ end
20
+ end
21
+ context 'admin.conversations.whitelist_remove' do
22
+ it 'requires channel_id' do
23
+ expect { client.admin_conversations_whitelist_remove(group_id: '', team_id: '') }.to raise_error ArgumentError, /Required arguments :channel_id missing/
24
+ end
25
+ it 'requires group_id' do
26
+ expect { client.admin_conversations_whitelist_remove(channel_id: '', team_id: '') }.to raise_error ArgumentError, /Required arguments :group_id missing/
27
+ end
28
+ it 'requires team_id' do
29
+ expect { client.admin_conversations_whitelist_remove(channel_id: '', group_id: '') }.to raise_error ArgumentError, /Required arguments :team_id missing/
30
+ end
31
+ end
32
+ end