slack-ruby-client 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -3
  3. data/LICENSE.md +1 -1
  4. data/README.md +8 -8
  5. data/bin/commands.rb +0 -1
  6. data/bin/commands/admin_analytics.rb +2 -1
  7. data/bin/commands/admin_conversations.rb +0 -10
  8. data/bin/commands/admin_teams.rb +1 -1
  9. data/bin/commands/channels.rb +0 -157
  10. data/bin/commands/chat.rb +8 -6
  11. data/bin/commands/conversations.rb +2 -2
  12. data/bin/commands/dnd.rb +2 -0
  13. data/bin/commands/groups.rb +0 -163
  14. data/bin/commands/im.rb +0 -62
  15. data/bin/commands/mpim.rb +0 -60
  16. data/lib/slack/events/request.rb +2 -2
  17. data/lib/slack/real_time/config.rb +3 -13
  18. data/lib/slack/version.rb +1 -1
  19. data/lib/slack/web/api/endpoints.rb +0 -2
  20. data/lib/slack/web/api/endpoints/admin_analytics.rb +3 -1
  21. data/lib/slack/web/api/endpoints/admin_conversations.rb +0 -14
  22. data/lib/slack/web/api/endpoints/admin_teams.rb +1 -1
  23. data/lib/slack/web/api/endpoints/channels.rb +0 -265
  24. data/lib/slack/web/api/endpoints/chat.rb +11 -7
  25. data/lib/slack/web/api/endpoints/conversations.rb +2 -2
  26. data/lib/slack/web/api/endpoints/dnd.rb +4 -0
  27. data/lib/slack/web/api/endpoints/groups.rb +0 -273
  28. data/lib/slack/web/api/endpoints/im.rb +0 -107
  29. data/lib/slack/web/api/endpoints/mpim.rb +0 -102
  30. data/lib/slack/web/api/errors.rb +14 -16
  31. data/lib/slack/web/api/patches/chat.1.patch +5 -6
  32. data/lib/slack/web/faraday/connection.rb +1 -1
  33. data/lib/slack/web/faraday/response/raise_error.rb +0 -4
  34. data/lib/slack/web/faraday/response/wrap_error.rb +11 -5
  35. data/lib/tasks/web.rake +4 -0
  36. data/spec/fixtures/slack/web/{groups_info.yml → conversations_info.yml} +4 -4
  37. data/spec/slack/events/request_spec.rb +6 -5
  38. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
  39. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
  40. data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
  41. data/spec/slack/real_time/rtm_start_spec.rb +1 -1
  42. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +0 -5
  43. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
  44. data/spec/slack/web/api/endpoints/im_spec.rb +0 -31
  45. data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -31
  46. data/spec/slack/web/client_spec.rb +15 -20
  47. metadata +10 -12
  48. data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +0 -32
  49. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
  50. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
  51. data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
@@ -6,108 +6,6 @@ module Slack
6
6
  module Api
7
7
  module Endpoints
8
8
  module Mpim
9
- #
10
- # Closes a multiparty direct message channel.
11
- #
12
- # @option options [channel] :channel
13
- # MPIM to close.
14
- # @see https://api.slack.com/methods/mpim.close
15
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.close.json
16
- def mpim_close(options = {})
17
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
18
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
19
- logger.warn('mpim.close: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.close.')
20
- post('mpim.close', options)
21
- end
22
-
23
- #
24
- # Fetches history of messages and events from a multiparty direct message.
25
- #
26
- # @option options [channel] :channel
27
- # Multiparty direct message to fetch history for.
28
- # @option options [Object] :inclusive
29
- # Include messages with latest or oldest timestamp in results.
30
- # @option options [timestamp] :latest
31
- # End of time range of messages to include in results.
32
- # @option options [timestamp] :oldest
33
- # Start of time range of messages to include in results.
34
- # @option options [Object] :unreads
35
- # Include unread_count_display in the output?.
36
- # @see https://api.slack.com/methods/mpim.history
37
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.history.json
38
- def mpim_history(options = {})
39
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
40
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
41
- logger.warn('mpim.history: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.history.')
42
- post('mpim.history', options)
43
- end
44
-
45
- #
46
- # Lists multiparty direct message channels for the calling user.
47
- #
48
- # @option options [Object] :cursor
49
- # Parameter for pagination. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first "page" of the collection. See pagination for more details.
50
- # @option options [Object] :limit
51
- # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached.
52
- # @see https://api.slack.com/methods/mpim.list
53
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.list.json
54
- def mpim_list(options = {})
55
- logger.warn('mpim.list: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.list, users.conversations.')
56
- if block_given?
57
- Pagination::Cursor.new(self, :mpim_list, options).each do |page|
58
- yield page
59
- end
60
- else
61
- post('mpim.list', options)
62
- end
63
- end
64
-
65
- #
66
- # Sets the read cursor in a multiparty direct message channel.
67
- #
68
- # @option options [channel] :channel
69
- # Channel or conversation to set the read cursor for.
70
- # @option options [timestamp] :ts
71
- # Unique identifier of message you want marked as most recently seen in this conversation.
72
- # @see https://api.slack.com/methods/mpim.mark
73
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.mark.json
74
- def mpim_mark(options = {})
75
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
76
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
77
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
78
- logger.warn('mpim.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.')
79
- post('mpim.mark', options)
80
- end
81
-
82
- #
83
- # This method opens a multiparty direct message.
84
- #
85
- # @option options [Object] :users
86
- # Comma separated lists of users. The ordering of the users is preserved whenever a MPIM group is returned.
87
- # @see https://api.slack.com/methods/mpim.open
88
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.open.json
89
- def mpim_open(options = {})
90
- throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
91
- logger.warn('mpim.open: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.open.')
92
- post('mpim.open', options)
93
- end
94
-
95
- #
96
- # Retrieve a thread of messages posted to a direct message conversation from a multiparty direct message.
97
- #
98
- # @option options [channel] :channel
99
- # Multiparty direct message channel to fetch thread from.
100
- # @option options [Object] :thread_ts
101
- # Unique identifier of a thread's parent message.
102
- # @see https://api.slack.com/methods/mpim.replies
103
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.replies.json
104
- def mpim_replies(options = {})
105
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
106
- throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
107
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
108
- logger.warn('mpim.replies: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.replies.')
109
- post('mpim.replies', options)
110
- end
111
9
  end
112
10
  end
113
11
  end
@@ -53,8 +53,6 @@ module Slack
53
53
  class CannotFindService < SlackError; end
54
54
  class CannotInstallAnOrgInstalledApp < SlackError; end
55
55
  class CannotInvalidatePrimaryOwner < SlackError; end
56
- class CannotKickHomeTeam < SlackError; end
57
- class CannotKickTeam < SlackError; end
58
56
  class CannotModifyPrimaryOwner < SlackError; end
59
57
  class CannotMoveLocalChannel < SlackError; end
60
58
  class CannotParse < SlackError; end
@@ -166,8 +164,8 @@ module Slack
166
164
  class FileNotYetAvailable < SlackError; end
167
165
  class FileUnderReview < SlackError; end
168
166
  class ForbiddenHandle < SlackError; end
167
+ class ForbiddenTeam < SlackError; end
169
168
  class GroupAlreadyLinkedToChannel < SlackError; end
170
- class GroupContainsOthers < SlackError; end
171
169
  class GroupMustNotBeEmpty < SlackError; end
172
170
  class GroupNotFound < SlackError; end
173
171
  class HandleAlreadyExists < SlackError; end
@@ -187,6 +185,7 @@ module Slack
187
185
  class InvalidCallId < SlackError; end
188
186
  class InvalidChannel < SlackError; end
189
187
  class InvalidChannelId < SlackError; end
188
+ class InvalidChannelType < SlackError; end
190
189
  class InvalidChannelsLimit < SlackError; end
191
190
  class InvalidCharset < SlackError; end
192
191
  class InvalidClientId < SlackError; end
@@ -198,7 +197,6 @@ module Slack
198
197
  class InvalidEmail < SlackError; end
199
198
  class InvalidEventContext < SlackError; end
200
199
  class InvalidExternalId < SlackError; end
201
- class InvalidForIsMpim < SlackError; end
202
200
  class InvalidFormData < SlackError; end
203
201
  class InvalidGrantType < SlackError; end
204
202
  class InvalidInputs < SlackError; end
@@ -250,12 +248,12 @@ module Slack
250
248
  class IsBot < SlackError; end
251
249
  class IsInactive < SlackError; end
252
250
  class LastMember < SlackError; end
253
- class LeavingTeamNotInChannel < SlackError; end
254
- class LeavingTeamRequired < SlackError; end
255
251
  class LimitRequired < SlackError; end
256
252
  class LinkNotFound < SlackError; end
257
253
  class MemberAnalyticsDisabled < SlackError; end
258
254
  class MessageNotFound < SlackError; end
255
+ class MetadataNotAvailable < SlackError; end
256
+ class MetadataOnlyDoesNotSupportDate < SlackError; end
259
257
  class MethodDeprecated < SlackError; end
260
258
  class MethodNotSupportedForChannelType < SlackError; end
261
259
  class MigrationInProgress < SlackError; end
@@ -294,13 +292,13 @@ module Slack
294
292
  class NoScopes < SlackError; end
295
293
  class NoSuchSubteam < SlackError; end
296
294
  class NoTeamIdsGiven < SlackError; end
297
- class NoTeamsToDisconnect < SlackError; end
298
295
  class NoText < SlackError; end
299
296
  class NoUser < SlackError; end
300
297
  class NoUserProvided < SlackError; end
301
298
  class NoUsersProvided < SlackError; end
302
299
  class NotAdmin < SlackError; end
303
300
  class NotAllowed < SlackError; end
301
+ class NotAllowedForGridWorkspace < SlackError; end
304
302
  class NotAllowedTokenType < SlackError; end
305
303
  class NotAnAdmin < SlackError; end
306
304
  class NotAnEnterprise < SlackError; end
@@ -316,13 +314,13 @@ module Slack
316
314
  class NotImplemented < SlackError; end
317
315
  class NotInChannel < SlackError; end
318
316
  class NotInDnd < SlackError; end
319
- class NotInGroup < SlackError; end
320
317
  class NotPinnable < SlackError; end
321
318
  class NotPinned < SlackError; end
322
319
  class NotReactable < SlackError; end
323
320
  class NotStarred < SlackError; end
324
321
  class NotSupported < SlackError; end
325
322
  class OauthAuthorizationUrlMismatch < SlackError; end
323
+ class OneOrMoreInvalidChannels < SlackError; end
326
324
  class OrgLevelEmailDisplayDisabled < SlackError; end
327
325
  class OrgLoginRequired < SlackError; end
328
326
  class OrgNotFound < SlackError; end
@@ -358,6 +356,7 @@ module Slack
358
356
  class SessionExpired < SlackError; end
359
357
  class SessionInvalidationFailed < SlackError; end
360
358
  class SessionNotFound < SlackError; end
359
+ class SlackConnectBlockedFileType < SlackError; end
361
360
  class SlackConnectFileLinkSharingBlocked < SlackError; end
362
361
  class SlackConnectFileUploadSharingBlocked < SlackError; end
363
362
  class SnoozeEndFailed < SlackError; end
@@ -473,8 +472,6 @@ module Slack
473
472
  'cannot_find_service' => CannotFindService,
474
473
  'cannot_install_an_org_installed_app' => CannotInstallAnOrgInstalledApp,
475
474
  'cannot_invalidate_primary_owner' => CannotInvalidatePrimaryOwner,
476
- 'cannot_kick_home_team' => CannotKickHomeTeam,
477
- 'cannot_kick_team' => CannotKickTeam,
478
475
  'cannot_modify_primary_owner' => CannotModifyPrimaryOwner,
479
476
  'cannot_move_local_channel' => CannotMoveLocalChannel,
480
477
  'cannot_parse' => CannotParse,
@@ -586,8 +583,8 @@ module Slack
586
583
  'file_not_yet_available' => FileNotYetAvailable,
587
584
  'file_under_review' => FileUnderReview,
588
585
  'forbidden_handle' => ForbiddenHandle,
586
+ 'forbidden_team' => ForbiddenTeam,
589
587
  'group_already_linked_to_channel' => GroupAlreadyLinkedToChannel,
590
- 'group_contains_others' => GroupContainsOthers,
591
588
  'group_must_not_be_empty' => GroupMustNotBeEmpty,
592
589
  'group_not_found' => GroupNotFound,
593
590
  'handle_already_exists' => HandleAlreadyExists,
@@ -607,6 +604,7 @@ module Slack
607
604
  'invalid_call_id' => InvalidCallId,
608
605
  'invalid_channel' => InvalidChannel,
609
606
  'invalid_channel_id' => InvalidChannelId,
607
+ 'invalid_channel_type' => InvalidChannelType,
610
608
  'invalid_channels_limit' => InvalidChannelsLimit,
611
609
  'invalid_charset' => InvalidCharset,
612
610
  'invalid_client_id' => InvalidClientId,
@@ -618,7 +616,6 @@ module Slack
618
616
  'invalid_email' => InvalidEmail,
619
617
  'invalid_event_context' => InvalidEventContext,
620
618
  'invalid_external_id' => InvalidExternalId,
621
- 'invalid_for_is_mpim' => InvalidForIsMpim,
622
619
  'invalid_form_data' => InvalidFormData,
623
620
  'invalid_grant_type' => InvalidGrantType,
624
621
  'invalid_inputs' => InvalidInputs,
@@ -670,12 +667,12 @@ module Slack
670
667
  'is_bot' => IsBot,
671
668
  'is_inactive' => IsInactive,
672
669
  'last_member' => LastMember,
673
- 'leaving_team_not_in_channel' => LeavingTeamNotInChannel,
674
- 'leaving_team_required' => LeavingTeamRequired,
675
670
  'limit_required' => LimitRequired,
676
671
  'link_not_found' => LinkNotFound,
677
672
  'member_analytics_disabled' => MemberAnalyticsDisabled,
678
673
  'message_not_found' => MessageNotFound,
674
+ 'metadata_not_available' => MetadataNotAvailable,
675
+ 'metadata_only_does_not_support_date' => MetadataOnlyDoesNotSupportDate,
679
676
  'method_deprecated' => MethodDeprecated,
680
677
  'method_not_supported_for_channel_type' => MethodNotSupportedForChannelType,
681
678
  'migration_in_progress' => MigrationInProgress,
@@ -714,13 +711,13 @@ module Slack
714
711
  'no_scopes' => NoScopes,
715
712
  'no_such_subteam' => NoSuchSubteam,
716
713
  'no_team_ids_given' => NoTeamIdsGiven,
717
- 'no_teams_to_disconnect' => NoTeamsToDisconnect,
718
714
  'no_text' => NoText,
719
715
  'no_user' => NoUser,
720
716
  'no_user_provided' => NoUserProvided,
721
717
  'no_users_provided' => NoUsersProvided,
722
718
  'not_admin' => NotAdmin,
723
719
  'not_allowed' => NotAllowed,
720
+ 'not_allowed_for_grid_workspace' => NotAllowedForGridWorkspace,
724
721
  'not_allowed_token_type' => NotAllowedTokenType,
725
722
  'not_an_admin' => NotAnAdmin,
726
723
  'not_an_enterprise' => NotAnEnterprise,
@@ -736,13 +733,13 @@ module Slack
736
733
  'not_implemented' => NotImplemented,
737
734
  'not_in_channel' => NotInChannel,
738
735
  'not_in_dnd' => NotInDnd,
739
- 'not_in_group' => NotInGroup,
740
736
  'not_pinnable' => NotPinnable,
741
737
  'not_pinned' => NotPinned,
742
738
  'not_reactable' => NotReactable,
743
739
  'not_starred' => NotStarred,
744
740
  'not_supported' => NotSupported,
745
741
  'oauth_authorization_url_mismatch' => OauthAuthorizationUrlMismatch,
742
+ 'one_or_more_invalid_channels' => OneOrMoreInvalidChannels,
746
743
  'org_level_email_display_disabled' => OrgLevelEmailDisplayDisabled,
747
744
  'org_login_required' => OrgLoginRequired,
748
745
  'org_not_found' => OrgNotFound,
@@ -778,6 +775,7 @@ module Slack
778
775
  'session_expired' => SessionExpired,
779
776
  'session_invalidation_failed' => SessionInvalidationFailed,
780
777
  'session_not_found' => SessionNotFound,
778
+ 'slack_connect_blocked_file_type' => SlackConnectBlockedFileType,
781
779
  'slack_connect_file_link_sharing_blocked' => SlackConnectFileLinkSharingBlocked,
782
780
  'slack_connect_file_upload_sharing_blocked' => SlackConnectFileUploadSharingBlocked,
783
781
  'snooze_end_failed' => SnoozeEndFailed,
@@ -1,5 +1,5 @@
1
1
  diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
2
- index 9de4aa9..8ed5625 100644
2
+ index d090ae2..50186d5 100644
3
3
  --- a/lib/slack/web/api/endpoints/chat.rb
4
4
  +++ b/lib/slack/web/api/endpoints/chat.rb
5
5
  @@ -121,11 +121,22 @@ module Slack
@@ -26,12 +26,11 @@ index 9de4aa9..8ed5625 100644
26
26
  + end
27
27
  post('chat.postEphemeral', options)
28
28
  end
29
-
30
- @@ -166,7 +177,19 @@ module Slack
29
+
30
+ @@ -168,6 +179,19 @@ module Slack
31
31
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
32
32
  def chat_postMessage(options = {})
33
33
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
34
- - throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
35
34
  + throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
36
35
  + # attachments must be passed as an encoded JSON string
37
36
  + if options.key?(:attachments)
@@ -47,8 +46,8 @@ index 9de4aa9..8ed5625 100644
47
46
  + end
48
47
  post('chat.postMessage', options)
49
48
  end
50
-
51
- @@ -254,8 +277,21 @@ module Slack
49
+
50
+ @@ -257,8 +281,21 @@ module Slack
52
51
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
53
52
  def chat_update(options = {})
54
53
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
@@ -24,10 +24,10 @@ module Slack
24
24
  ::Faraday::Connection.new(endpoint, options) do |connection|
25
25
  connection.use ::Faraday::Request::Multipart
26
26
  connection.use ::Faraday::Request::UrlEncoded
27
- connection.use ::Slack::Web::Faraday::Response::WrapError
28
27
  connection.use ::Slack::Web::Faraday::Response::RaiseError
29
28
  connection.use ::FaradayMiddleware::Mashify, mash_class: Slack::Messages::Message
30
29
  connection.use ::FaradayMiddleware::ParseJson
30
+ connection.use ::Slack::Web::Faraday::Response::WrapError
31
31
  connection.response :logger, logger if logger
32
32
  connection.adapter adapter
33
33
  end
@@ -23,12 +23,8 @@ module Slack
23
23
 
24
24
  def call(env)
25
25
  super
26
- rescue Slack::Web::Api::Errors::SlackError, Slack::Web::Api::Errors::TooManyRequestsError
27
- raise
28
26
  rescue ::Faraday::ParsingError
29
27
  raise Slack::Web::Api::Errors::ParsingError.new('parsing_error', env.response)
30
- rescue ::Faraday::TimeoutError, ::Faraday::ConnectionFailed
31
- raise Slack::Web::Api::Errors::TimeoutError.new('timeout_error', env.response)
32
28
  end
33
29
  end
34
30
  end
@@ -3,14 +3,20 @@ module Slack
3
3
  module Web
4
4
  module Faraday
5
5
  module Response
6
- class WrapError < ::Faraday::Response::RaiseError
6
+ class WrapError < ::Faraday::Response::Middleware
7
+ UNAVAILABLE_ERROR_STATUSES = (500..599).freeze
8
+
7
9
  def on_complete(env)
8
- super
9
- rescue Slack::Web::Api::Errors::SlackError
10
- raise
11
- rescue ::Faraday::ServerError
10
+ return unless UNAVAILABLE_ERROR_STATUSES.cover?(env.status)
11
+
12
12
  raise Slack::Web::Api::Errors::UnavailableError.new('unavailable_error', env.response)
13
13
  end
14
+
15
+ def call(env)
16
+ super
17
+ rescue ::Faraday::TimeoutError, ::Faraday::ConnectionFailed
18
+ raise Slack::Web::Api::Errors::TimeoutError.new('timeout_error', env.response)
19
+ end
14
20
  end
15
21
  end
16
22
  end
data/lib/tasks/web.rake CHANGED
@@ -32,6 +32,10 @@ namespace :slack do
32
32
  parsed = JSON.parse(File.read(path))
33
33
  parsed['undocumented'] = true if path =~ /undocumented/
34
34
  JSON::Validator.validate(method_schema, parsed, insert_defaults: true)
35
+ if parsed['deprecated'] && parsed['deprecation']['deprecation_warning'] =~ /It will stop functioning in February 2021/
36
+ next
37
+ end
38
+
35
39
  result[prefix][name] = parsed
36
40
  end
37
41
 
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://slack.com/api/groups.list
5
+ uri: https://slack.com/api/conversations.list
6
6
  body:
7
7
  encoding: UTF-8
8
8
  string: token=token
@@ -15,14 +15,14 @@ http_interactions:
15
15
  - application/json; charset=utf-8
16
16
  body:
17
17
  encoding: ASCII-8BIT
18
- string: '{"ok":true,"groups":[{"id":"G0K7EV5A7","name":"mpdm-dblock--rubybot--player1-1","is_group":true,"created":1453561861,"creator":"U04KB5WQR","is_archived":false,"is_mpim":true,"members":["U04KB5WQR","U0HLFUZLJ","U07518DTL"],"topic":{"value":"Group
18
+ string: '{"ok":true,"channels":[{"id":"G0K7EV5A7","name":"mpdm-dblock--rubybot--player1-1","is_group":true,"created":1453561861,"creator":"U04KB5WQR","is_archived":false,"is_mpim":true,"members":["U04KB5WQR","U0HLFUZLJ","U07518DTL"],"topic":{"value":"Group
19
19
  messaging","creator":"U04KB5WQR","last_set":1453561861},"purpose":{"value":"Group
20
20
  messaging with: @dblock @rubybot @player1","creator":"U04KB5WQR","last_set":1453561861}}]}'
21
21
  http_version:
22
22
  recorded_at: Sat, 23 Jan 2016 15:19:10 GMT
23
23
  - request:
24
24
  method: post
25
- uri: https://slack.com/api/groups.info
25
+ uri: https://slack.com/api/conversations.info
26
26
  body:
27
27
  encoding: UTF-8
28
28
  string: channel=G0K7EV5A7&token=token
@@ -35,7 +35,7 @@ http_interactions:
35
35
  - application/json; charset=utf-8
36
36
  body:
37
37
  encoding: ASCII-8BIT
38
- string: '{"ok":true,"group":{"id":"G0K7EV5A7","name":"mpdm-dblock--rubybot--player1-1","is_group":true,"created":1453561861,"creator":"U04KB5WQR","is_archived":false,"is_mpim":true,"is_open":false,"last_read":"0000000000.000000","latest":null,"unread_count":0,"unread_count_display":0,"members":["U04KB5WQR","U0HLFUZLJ","U07518DTL"],"topic":{"value":"Group
38
+ string: '{"ok":true,"channel":{"id":"G0K7EV5A7","name":"mpdm-dblock--rubybot--player1-1","is_group":true,"created":1453561861,"creator":"U04KB5WQR","is_archived":false,"is_mpim":true,"is_open":false,"last_read":"0000000000.000000","latest":null,"unread_count":0,"unread_count_display":0,"members":["U04KB5WQR","U0HLFUZLJ","U07518DTL"],"topic":{"value":"Group
39
39
  messaging","creator":"U04KB5WQR","last_set":1453561861},"purpose":{"value":"Group
40
40
  messaging with: @dblock @rubybot @player1","creator":"U04KB5WQR","last_set":1453561861}}}'
41
41
  http_version:
@@ -21,13 +21,14 @@ RSpec.describe Slack::Events::Request do
21
21
  '"P7sFXA4o3HV2hTx4zb4zcQ9yrvuQs8pDh6EacOxmMRj0tJaXfQFF","type":"url_verification"}'
22
22
  end
23
23
  let(:http_request) do
24
- double(
25
- headers: {
26
- 'X-Slack-Request-Timestamp' => timestamp,
27
- 'X-Slack-Signature' => signature
28
- },
24
+ request_double = double(
29
25
  body: StringIO.new(body)
30
26
  )
27
+
28
+ allow(request_double).to receive(:get_header).with('HTTP_X_SLACK_REQUEST_TIMESTAMP') { timestamp }
29
+ allow(request_double).to receive(:get_header).with('HTTP_X_SLACK_SIGNATURE') { signature }
30
+
31
+ request_double
31
32
  end
32
33
 
33
34
  after do
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe 'with CONCURRENCY', skip: ( # rubocop:disable RSpec/DescribeClass
5
+ (!ENV['CONCURRENCY']) && 'missing CONCURRENCY'
6
+ ) do
7
+ it 'detects concurrency' do
8
+ expect(Slack::RealTime::Config.concurrency).to eq Slack::RealTime::Concurrency::Async
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe 'without CONCURRENCY', skip: ( # rubocop:disable RSpec/DescribeClass
5
+ (ENV['CONCURRENCY']) && 'CONCURRENCY is set'
6
+ ) do
7
+ it 'raises NoConcurrencyError' do
8
+ expect { Slack::RealTime::Config.concurrency }.to raise_error Slack::RealTime::Config::NoConcurrencyError
9
+ end
10
+ end