slack-ruby-client 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/danger.yml +19 -0
  3. data/.github/workflows/integtest.yml +25 -0
  4. data/.github/workflows/rubocop.yml +13 -0
  5. data/.github/workflows/test.yml +34 -0
  6. data/.gitignore +5 -3
  7. data/.rubocop.yml +2 -1
  8. data/.rubocop_todo.yml +86 -26
  9. data/CHANGELOG.md +13 -0
  10. data/CONTRIBUTING.md +1 -1
  11. data/Gemfile +18 -1
  12. data/Gemfile.danger +6 -0
  13. data/README.md +3 -2
  14. data/RELEASING.md +1 -1
  15. data/bin/commands/admin_apps_requests.rb +11 -0
  16. data/bin/commands/admin_conversations.rb +1 -0
  17. data/bin/commands/admin_emoji.rb +2 -2
  18. data/bin/commands/admin_users_unsupportedVersions.rb +15 -0
  19. data/bin/commands/apps_manifest.rb +1 -0
  20. data/bin/commands/bookmarks.rb +52 -0
  21. data/bin/commands/team.rb +1 -0
  22. data/bin/commands.rb +2 -0
  23. data/lib/slack/real_time/client.rb +2 -2
  24. data/lib/slack/version.rb +1 -1
  25. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +16 -0
  26. data/lib/slack/web/api/endpoints/admin_conversations.rb +2 -0
  27. data/lib/slack/web/api/endpoints/admin_emoji.rb +2 -2
  28. data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +25 -0
  29. data/lib/slack/web/api/endpoints/apps_manifest.rb +2 -0
  30. data/lib/slack/web/api/endpoints/bookmarks.rb +86 -0
  31. data/lib/slack/web/api/endpoints/chat.rb +1 -1
  32. data/lib/slack/web/api/endpoints/team.rb +2 -0
  33. data/lib/slack/web/api/endpoints.rb +4 -0
  34. data/lib/slack/web/api/errors.rb +28 -2
  35. data/lib/slack/web/api/patches/chat.1.patch +1 -1
  36. data/lib/slack/web/faraday/connection.rb +4 -4
  37. data/lib/slack/web/faraday/request.rb +2 -0
  38. data/lib/slack/web/faraday/response/raise_error.rb +2 -10
  39. data/lib/slack/web/faraday/response/wrap_error.rb +1 -1
  40. data/lib/slack-ruby-client.rb +2 -1
  41. data/lib/tasks/real_time.rake +1 -3
  42. data/slack-ruby-client.gemspec +5 -13
  43. data/spec/integration/integration_spec.rb +1 -1
  44. data/spec/slack/events/request_spec.rb +1 -1
  45. data/spec/slack/real_time/client_spec.rb +20 -18
  46. data/spec/slack/real_time/event_handlers/channel_spec.rb +8 -8
  47. data/spec/slack/real_time/event_handlers/group_spec.rb +2 -2
  48. data/spec/slack/real_time/event_handlers/im_spec.rb +2 -2
  49. data/spec/slack/real_time/store_spec.rb +2 -2
  50. data/spec/slack/slack_spec.rb +4 -4
  51. data/spec/slack/version_spec.rb +1 -1
  52. data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +5 -0
  53. data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +8 -0
  54. data/spec/slack/web/api/endpoints/bookmarks_spec.rb +40 -0
  55. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +28 -16
  56. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +4 -2
  57. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +22 -14
  58. data/spec/slack/web/api/pagination/cursor_spec.rb +7 -7
  59. data/spec/slack/web/client_spec.rb +25 -7
  60. data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -1
  61. data/spec/support/real_time/connected_client.rb +1 -1
  62. metadata +25 -154
  63. data/.travis.yml +0 -29
@@ -23,6 +23,8 @@ module Slack
23
23
  #
24
24
  # @option options [Object] :channel_id
25
25
  # The channel to convert to private.
26
+ # @option options [string] :name
27
+ # Name of private channel to create. Only respected when converting an MPIM.
26
28
  # @see https://api.slack.com/methods/admin.conversations.convertToPrivate
27
29
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.convertToPrivate.json
28
30
  def admin_conversations_convertToPrivate(options = {})
@@ -25,9 +25,9 @@ module Slack
25
25
  # Add an emoji alias.
26
26
  #
27
27
  # @option options [string] :alias_for
28
- # The alias of the emoji.
28
+ # Name of the emoji for which the alias is being made. Any wrapping whitespace or colons will be automatically trimmed.
29
29
  # @option options [string] :name
30
- # The name of the emoji to be aliased. Colons (:myemoji:) around the value are not required, although they may be included.
30
+ # The new alias for the specified emoji. Any wrapping whitespace or colons will be automatically trimmed.
31
31
  # @see https://api.slack.com/methods/admin.emoji.addAlias
32
32
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.emoji/admin.emoji.addAlias.json
33
33
  def admin_emoji_addAlias(options = {})
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module AdminUsersUnsupportedversions
9
+ #
10
+ # Ask Slackbot to send you an export listing all workspace members using unsupported software, presented as a zipped CSV file.
11
+ #
12
+ # @option options [integer] :date_end_of_support
13
+ # Unix timestamp of the date of past or upcoming end of support cycles. If not provided will include all announced end of support cycles.
14
+ # @option options [integer] :date_sessions_started
15
+ # Unix timestamp of a date to start looking for user sessions. If not provided will start six months ago.
16
+ # @see https://api.slack.com/methods/admin.users.unsupportedVersions.export
17
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.unsupportedVersions/admin.users.unsupportedVersions.export.json
18
+ def admin_users_unsupportedVersions_export(options = {})
19
+ post('admin.users.unsupportedVersions.export', options)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -62,6 +62,8 @@ module Slack
62
62
  #
63
63
  # @option options [manifest object as string] :manifest
64
64
  # The manifest to be validated. Will be validated against the app manifest schema - read our guide.
65
+ # @option options [Object] :app_id
66
+ # The ID of the app whose configuration you want to validate.
65
67
  # @see https://api.slack.com/methods/apps.manifest.validate
66
68
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.manifest/apps.manifest.validate.json
67
69
  def apps_manifest_validate(options = {})
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module Bookmarks
9
+ #
10
+ # Add bookmark to a channel.
11
+ #
12
+ # @option options [string] :channel_id
13
+ # Channel to add bookmark in.
14
+ # @option options [string] :title
15
+ # Title for the bookmark.
16
+ # @option options [string] :type
17
+ # Type of the bookmark i.e link.
18
+ # @option options [string] :emoji
19
+ # Emoji tag to apply to the link.
20
+ # @option options [string] :entity_id
21
+ # ID of the entity being bookmarked. Only applies to message and file types.
22
+ # @option options [string] :link
23
+ # Link to bookmark.
24
+ # @option options [string] :parent_id
25
+ # Id of this bookmark's parent.
26
+ # @see https://api.slack.com/methods/bookmarks.add
27
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bookmarks/bookmarks.add.json
28
+ def bookmarks_add(options = {})
29
+ throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
30
+ throw ArgumentError.new('Required arguments :title missing') if options[:title].nil?
31
+ throw ArgumentError.new('Required arguments :type missing') if options[:type].nil?
32
+ post('bookmarks.add', options)
33
+ end
34
+
35
+ #
36
+ # Edit bookmark.
37
+ #
38
+ # @option options [string] :bookmark_id
39
+ # Bookmark to update.
40
+ # @option options [string] :channel_id
41
+ # Channel to update bookmark in.
42
+ # @option options [string] :emoji
43
+ # Emoji tag to apply to the link.
44
+ # @option options [string] :link
45
+ # Link to bookmark.
46
+ # @option options [string] :title
47
+ # Title for the bookmark.
48
+ # @see https://api.slack.com/methods/bookmarks.edit
49
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bookmarks/bookmarks.edit.json
50
+ def bookmarks_edit(options = {})
51
+ throw ArgumentError.new('Required arguments :bookmark_id missing') if options[:bookmark_id].nil?
52
+ throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
53
+ post('bookmarks.edit', options)
54
+ end
55
+
56
+ #
57
+ # List bookmark for the channel.
58
+ #
59
+ # @option options [string] :channel_id
60
+ # Channel to list bookmarks in.
61
+ # @see https://api.slack.com/methods/bookmarks.list
62
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bookmarks/bookmarks.list.json
63
+ def bookmarks_list(options = {})
64
+ throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
65
+ post('bookmarks.list', options)
66
+ end
67
+
68
+ #
69
+ # Remove bookmark from the channel.
70
+ #
71
+ # @option options [string] :bookmark_id
72
+ # Bookmark to remove.
73
+ # @option options [string] :channel_id
74
+ # Channel to remove bookmark.
75
+ # @see https://api.slack.com/methods/bookmarks.remove
76
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bookmarks/bookmarks.remove.json
77
+ def bookmarks_remove(options = {})
78
+ throw ArgumentError.new('Required arguments :bookmark_id missing') if options[:bookmark_id].nil?
79
+ throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
80
+ post('bookmarks.remove', options)
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -287,7 +287,7 @@ module Slack
287
287
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
288
288
  def chat_update(options = {})
289
289
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
290
- throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
290
+ throw ArgumentError.new('Required arguments :text, :attachments, :blocks or :reply_broadcast missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil? && options[:reply_broadcast].nil?
291
291
  throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
292
292
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
293
293
  # attachments must be passed as an encoded JSON string
@@ -36,6 +36,8 @@ module Slack
36
36
  #
37
37
  # Gets information about the current team.
38
38
  #
39
+ # @option options [string] :domain
40
+ # Query by domain instead of team (only when team is null). This only works for domains in the same enterprise as the querying team token. This also expects the domain to belong to a team and not the enterprise itself.
39
41
  # @option options [string] :team
40
42
  # Team to get info on, if omitted, will return information about the current team. Will only return team that the authenticated token is allowed to see through external shared channels.
41
43
  # @see https://api.slack.com/methods/team.info
@@ -22,6 +22,7 @@ require_relative 'endpoints/admin_teams_settings'
22
22
  require_relative 'endpoints/admin_usergroups'
23
23
  require_relative 'endpoints/admin_users'
24
24
  require_relative 'endpoints/admin_users_session'
25
+ require_relative 'endpoints/admin_users_unsupportedVersions'
25
26
  require_relative 'endpoints/api'
26
27
  require_relative 'endpoints/apps'
27
28
  require_relative 'endpoints/apps_connections'
@@ -29,6 +30,7 @@ require_relative 'endpoints/apps_event_authorizations'
29
30
  require_relative 'endpoints/apps_manifest'
30
31
  require_relative 'endpoints/auth'
31
32
  require_relative 'endpoints/auth_teams'
33
+ require_relative 'endpoints/bookmarks'
32
34
  require_relative 'endpoints/bots'
33
35
  require_relative 'endpoints/calls'
34
36
  require_relative 'endpoints/calls_participants'
@@ -93,6 +95,7 @@ module Slack
93
95
  include AdminUsergroups
94
96
  include AdminUsers
95
97
  include AdminUsersSession
98
+ include AdminUsersUnsupportedversions
96
99
  include Api
97
100
  include Apps
98
101
  include AppsConnections
@@ -100,6 +103,7 @@ module Slack
100
103
  include AppsManifest
101
104
  include Auth
102
105
  include AuthTeams
106
+ include Bookmarks
103
107
  include Bots
104
108
  include Calls
105
109
  include CallsParticipants
@@ -102,7 +102,6 @@ module Slack
102
102
  class ChannelTypeNotSupported < SlackError; end
103
103
  class ClientIdTokenMismatch < SlackError; end
104
104
  class CodeAlreadyUsed < SlackError; end
105
- class ComplianceExportsPreventDeletion < SlackError; end
106
105
  class ConnectionLimitExceeded < SlackError; end
107
106
  class ConnectionLimitExceededPending < SlackError; end
108
107
  class CouldNotArchiveChannel < SlackError; end
@@ -110,6 +109,7 @@ module Slack
110
109
  class CouldNotCreateChannel < SlackError; end
111
110
  class CouldNotCreateWorkspace < SlackError; end
112
111
  class CouldNotDeleteChannel < SlackError; end
112
+ class CouldNotExport < SlackError; end
113
113
  class CouldNotGetConversationPrefs < SlackError; end
114
114
  class CouldNotGetRetention < SlackError; end
115
115
  class CouldNotGetTeams < SlackError; end
@@ -220,6 +220,7 @@ module Slack
220
220
  class InvalidAuth < SlackError; end
221
221
  class InvalidBlocks < SlackError; end
222
222
  class InvalidBlocksFormat < SlackError; end
223
+ class InvalidBookmarkType < SlackError; end
223
224
  class InvalidCallId < SlackError; end
224
225
  class InvalidChannel < SlackError; end
225
226
  class InvalidChannelId < SlackError; end
@@ -227,6 +228,7 @@ module Slack
227
228
  class InvalidChannelType < SlackError; end
228
229
  class InvalidChannelsLimit < SlackError; end
229
230
  class InvalidCharset < SlackError; end
231
+ class InvalidChildType < SlackError; end
230
232
  class InvalidClientId < SlackError; end
231
233
  class InvalidCode < SlackError; end
232
234
  class InvalidCreatedBy < SlackError; end
@@ -234,7 +236,9 @@ module Slack
234
236
  class InvalidDate < SlackError; end
235
237
  class InvalidDuration < SlackError; end
236
238
  class InvalidEmail < SlackError; end
239
+ class InvalidEmoji < SlackError; end
237
240
  class InvalidEmojiNotAllowed < SlackError; end
241
+ class InvalidEntityId < SlackError; end
238
242
  class InvalidEventContext < SlackError; end
239
243
  class InvalidExternalId < SlackError; end
240
244
  class InvalidFormData < SlackError; end
@@ -252,12 +256,14 @@ module Slack
252
256
  class InvalidNameRequired < SlackError; end
253
257
  class InvalidNameSpecials < SlackError; end
254
258
  class InvalidOutputs < SlackError; end
259
+ class InvalidParentType < SlackError; end
255
260
  class InvalidPayload < SlackError; end
256
261
  class InvalidPermissions < SlackError; end
257
262
  class InvalidPostType < SlackError; end
258
263
  class InvalidPresence < SlackError; end
259
264
  class InvalidPrivacy < SlackError; end
260
265
  class InvalidProfile < SlackError; end
266
+ class InvalidRecipientTeam < SlackError; end
261
267
  class InvalidRefreshToken < SlackError; end
262
268
  class InvalidRequest < SlackError; end
263
269
  class InvalidRequestId < SlackError; end
@@ -273,6 +279,7 @@ module Slack
273
279
  class InvalidStepStatus < SlackError; end
274
280
  class InvalidTargetTeam < SlackError; end
275
281
  class InvalidTeam < SlackError; end
282
+ class InvalidTeamId < SlackError; end
276
283
  class InvalidTeamIds < SlackError; end
277
284
  class InvalidTime < SlackError; end
278
285
  class InvalidTimestamp < SlackError; end
@@ -299,6 +306,7 @@ module Slack
299
306
  class InvitedUserNotCreated < SlackError; end
300
307
  class InvitedUserNotReactivated < SlackError; end
301
308
  class InviteeCantSeeChannel < SlackError; end
309
+ class InvitorCannotSeeChannel < SlackError; end
302
310
  class IsArchived < SlackError; end
303
311
  class IsBot < SlackError; end
304
312
  class IsInactive < SlackError; end
@@ -404,6 +412,9 @@ module Slack
404
412
  class PaginationNotAvailable < SlackError; end
405
413
  class PaidOnly < SlackError; end
406
414
  class PaidTeamsOnly < SlackError; end
415
+ class ParentBookmarkDisabled < SlackError; end
416
+ class ParentWithLink < SlackError; end
417
+ class PartialProfileSetFailed < SlackError; end
407
418
  class PermissionDenied < SlackError; end
408
419
  class PlanUpgradeRequired < SlackError; end
409
420
  class PolicyNotFound < SlackError; end
@@ -417,6 +428,7 @@ module Slack
417
428
  class RateLimited < SlackError; end
418
429
  class Ratelimit < SlackError; end
419
430
  class Ratelimited < SlackError; end
431
+ class RecipientsNotSpecified < SlackError; end
420
432
  class RequestAlreadyResolved < SlackError; end
421
433
  class RequestIdOrAppIdIsRequired < SlackError; end
422
434
  class RequestIdRequiredForCustomIntegrations < SlackError; end
@@ -463,6 +475,7 @@ module Slack
463
475
  class TooLarge < SlackError; end
464
476
  class TooLong < SlackError; end
465
477
  class TooManyAttachments < SlackError; end
478
+ class TooManyBookmarks < SlackError; end
466
479
  class TooManyContactCards < SlackError; end
467
480
  class TooManyConvosForAppOnTeam < SlackError; end
468
481
  class TooManyConvosForTeam < SlackError; end
@@ -617,7 +630,6 @@ module Slack
617
630
  'channel_type_not_supported' => ChannelTypeNotSupported,
618
631
  'client_id_token_mismatch' => ClientIdTokenMismatch,
619
632
  'code_already_used' => CodeAlreadyUsed,
620
- 'compliance_exports_prevent_deletion' => ComplianceExportsPreventDeletion,
621
633
  'connection_limit_exceeded' => ConnectionLimitExceeded,
622
634
  'connection_limit_exceeded_pending' => ConnectionLimitExceededPending,
623
635
  'could_not_archive_channel' => CouldNotArchiveChannel,
@@ -625,6 +637,7 @@ module Slack
625
637
  'could_not_create_channel' => CouldNotCreateChannel,
626
638
  'could_not_create_workspace' => CouldNotCreateWorkspace,
627
639
  'could_not_delete_channel' => CouldNotDeleteChannel,
640
+ 'could_not_export' => CouldNotExport,
628
641
  'could_not_get_conversation_prefs' => CouldNotGetConversationPrefs,
629
642
  'could_not_get_retention' => CouldNotGetRetention,
630
643
  'could_not_get_teams' => CouldNotGetTeams,
@@ -735,6 +748,7 @@ module Slack
735
748
  'invalid_auth' => InvalidAuth,
736
749
  'invalid_blocks' => InvalidBlocks,
737
750
  'invalid_blocks_format' => InvalidBlocksFormat,
751
+ 'invalid_bookmark_type' => InvalidBookmarkType,
738
752
  'invalid_call_id' => InvalidCallId,
739
753
  'invalid_channel' => InvalidChannel,
740
754
  'invalid_channel_id' => InvalidChannelId,
@@ -742,6 +756,7 @@ module Slack
742
756
  'invalid_channel_type' => InvalidChannelType,
743
757
  'invalid_channels_limit' => InvalidChannelsLimit,
744
758
  'invalid_charset' => InvalidCharset,
759
+ 'invalid_child_type' => InvalidChildType,
745
760
  'invalid_client_id' => InvalidClientId,
746
761
  'invalid_code' => InvalidCode,
747
762
  'invalid_created_by' => InvalidCreatedBy,
@@ -749,7 +764,9 @@ module Slack
749
764
  'invalid_date' => InvalidDate,
750
765
  'invalid_duration' => InvalidDuration,
751
766
  'invalid_email' => InvalidEmail,
767
+ 'invalid_emoji' => InvalidEmoji,
752
768
  'invalid_emoji_not_allowed' => InvalidEmojiNotAllowed,
769
+ 'invalid_entity_id' => InvalidEntityId,
753
770
  'invalid_event_context' => InvalidEventContext,
754
771
  'invalid_external_id' => InvalidExternalId,
755
772
  'invalid_form_data' => InvalidFormData,
@@ -767,12 +784,14 @@ module Slack
767
784
  'invalid_name_required' => InvalidNameRequired,
768
785
  'invalid_name_specials' => InvalidNameSpecials,
769
786
  'invalid_outputs' => InvalidOutputs,
787
+ 'invalid_parent_type' => InvalidParentType,
770
788
  'invalid_payload' => InvalidPayload,
771
789
  'invalid_permissions' => InvalidPermissions,
772
790
  'invalid_post_type' => InvalidPostType,
773
791
  'invalid_presence' => InvalidPresence,
774
792
  'invalid_privacy' => InvalidPrivacy,
775
793
  'invalid_profile' => InvalidProfile,
794
+ 'invalid_recipient_team' => InvalidRecipientTeam,
776
795
  'invalid_refresh_token' => InvalidRefreshToken,
777
796
  'invalid_request' => InvalidRequest,
778
797
  'invalid_request_id' => InvalidRequestId,
@@ -788,6 +807,7 @@ module Slack
788
807
  'invalid_step_status' => InvalidStepStatus,
789
808
  'invalid_target_team' => InvalidTargetTeam,
790
809
  'invalid_team' => InvalidTeam,
810
+ 'invalid_team_id' => InvalidTeamId,
791
811
  'invalid_team_ids' => InvalidTeamIds,
792
812
  'invalid_time' => InvalidTime,
793
813
  'invalid_timestamp' => InvalidTimestamp,
@@ -814,6 +834,7 @@ module Slack
814
834
  'invited_user_not_created' => InvitedUserNotCreated,
815
835
  'invited_user_not_reactivated' => InvitedUserNotReactivated,
816
836
  'invitee_cant_see_channel' => InviteeCantSeeChannel,
837
+ 'invitor_cannot_see_channel' => InvitorCannotSeeChannel,
817
838
  'is_archived' => IsArchived,
818
839
  'is_bot' => IsBot,
819
840
  'is_inactive' => IsInactive,
@@ -919,6 +940,9 @@ module Slack
919
940
  'pagination_not_available' => PaginationNotAvailable,
920
941
  'paid_only' => PaidOnly,
921
942
  'paid_teams_only' => PaidTeamsOnly,
943
+ 'parent_bookmark_disabled' => ParentBookmarkDisabled,
944
+ 'parent_with_link' => ParentWithLink,
945
+ 'partial_profile_set_failed' => PartialProfileSetFailed,
922
946
  'permission_denied' => PermissionDenied,
923
947
  'plan_upgrade_required' => PlanUpgradeRequired,
924
948
  'policy_not_found' => PolicyNotFound,
@@ -932,6 +956,7 @@ module Slack
932
956
  'rate_limited' => RateLimited,
933
957
  'ratelimit' => Ratelimit,
934
958
  'ratelimited' => Ratelimited,
959
+ 'recipients_not_specified' => RecipientsNotSpecified,
935
960
  'request_already_resolved' => RequestAlreadyResolved,
936
961
  'request_id_or_app_id_is_required' => RequestIdOrAppIdIsRequired,
937
962
  'request_id_required_for_custom_integrations' => RequestIdRequiredForCustomIntegrations,
@@ -978,6 +1003,7 @@ module Slack
978
1003
  'too_large' => TooLarge,
979
1004
  'too_long' => TooLong,
980
1005
  'too_many_attachments' => TooManyAttachments,
1006
+ 'too_many_bookmarks' => TooManyBookmarks,
981
1007
  'too_many_contact_cards' => TooManyContactCards,
982
1008
  'too_many_convos_for_app_on_team' => TooManyConvosForAppOnTeam,
983
1009
  'too_many_convos_for_team' => TooManyConvosForTeam,
@@ -50,7 +50,7 @@ index d090ae2..50186d5 100644
50
50
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
51
51
  def chat_update(options = {})
52
52
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
53
- + throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
53
+ + throw ArgumentError.new('Required arguments :text, :attachments, :blocks or :reply_broadcast missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil? && options[:reply_broadcast].nil?
54
54
  throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
55
55
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
56
56
  + # attachments must be passed as an encoded JSON string
@@ -22,11 +22,11 @@ module Slack
22
22
  options[:request] = request_options if request_options.any?
23
23
 
24
24
  ::Faraday::Connection.new(endpoint, options) do |connection|
25
- connection.use ::Faraday::Request::Multipart
26
- connection.use ::Faraday::Request::UrlEncoded
25
+ connection.request :multipart
26
+ connection.request :url_encoded
27
27
  connection.use ::Slack::Web::Faraday::Response::RaiseError
28
- connection.use ::FaradayMiddleware::Mashify, mash_class: Slack::Messages::Message
29
- connection.use ::FaradayMiddleware::ParseJson
28
+ connection.response :mashify, mash_class: Slack::Messages::Message
29
+ connection.response :json, content_type: /\b*$/
30
30
  connection.use ::Slack::Web::Faraday::Response::WrapError
31
31
  connection.response :logger, logger if logger
32
32
  connection.adapter adapter
@@ -35,6 +35,8 @@ module Slack
35
35
  request.options.merge!(options.delete(:request)) if options.key?(:request)
36
36
  end
37
37
  response.body
38
+ rescue ::Faraday::ParsingError => e
39
+ raise Slack::Web::Api::Errors::ParsingError, e.response
38
40
  end
39
41
  end
40
42
  end
@@ -3,7 +3,7 @@ module Slack
3
3
  module Web
4
4
  module Faraday
5
5
  module Response
6
- class RaiseError < ::Faraday::Response::Middleware
6
+ class RaiseError < ::Faraday::Middleware
7
7
  def on_complete(env)
8
8
  raise Slack::Web::Api::Errors::TooManyRequestsError, env.response if env.status == 429
9
9
 
@@ -13,19 +13,11 @@ module Slack
13
13
  return unless body
14
14
  return if body['ok']
15
15
 
16
- error_message =
17
- body['error'] || body['errors'].map { |message| message['error'] }.join(',')
18
-
16
+ error_message = body['error'] || body['errors'].map { |message| message['error'] }.join(',')
19
17
  error_class = Slack::Web::Api::Errors::ERROR_CLASSES[error_message]
20
18
  error_class ||= Slack::Web::Api::Errors::SlackError
21
19
  raise error_class.new(error_message, env.response)
22
20
  end
23
-
24
- def call(env)
25
- super
26
- rescue ::Faraday::ParsingError
27
- raise Slack::Web::Api::Errors::ParsingError, env.response
28
- end
29
21
  end
30
22
  end
31
23
  end
@@ -3,7 +3,7 @@ module Slack
3
3
  module Web
4
4
  module Faraday
5
5
  module Response
6
- class WrapError < ::Faraday::Response::Middleware
6
+ class WrapError < ::Faraday::Middleware
7
7
  UNAVAILABLE_ERROR_STATUSES = (500..599).freeze
8
8
 
9
9
  def on_complete(env)
@@ -10,7 +10,8 @@ require_relative 'slack/messages/formatting'
10
10
 
11
11
  # Web API
12
12
  require 'faraday'
13
- require 'faraday_middleware'
13
+ require 'faraday/mashify'
14
+ require 'faraday/multipart'
14
15
  require 'json'
15
16
  require 'logger'
16
17
  begin
@@ -49,9 +49,7 @@ namespace :slack do
49
49
  end
50
50
  end
51
51
 
52
- File.open store_file, 'w' do |f|
53
- f.write store_file_contents
54
- end
52
+ File.write(store_file, store_file_contents)
55
53
 
56
54
  puts ' done.'
57
55
  end
@@ -10,26 +10,18 @@ Gem::Specification.new do |s|
10
10
  s.authors = ['Daniel Doubrovkine']
11
11
  s.email = 'dblock@dblock.org'
12
12
  s.platform = Gem::Platform::RUBY
13
+ s.required_ruby_version = '>= 2.7'
13
14
  s.required_rubygems_version = '>= 1.3.6'
14
15
  s.files = `git ls-files`.split("\n")
15
16
  s.require_paths = ['lib']
16
17
  s.homepage = 'http://github.com/slack-ruby/slack-ruby-client'
17
18
  s.licenses = ['MIT']
18
19
  s.summary = 'Slack Web and RealTime API client.'
19
- s.add_dependency 'faraday', '>= 1.0'
20
- s.add_dependency 'faraday_middleware'
20
+ s.add_dependency 'faraday', '>= 2.0'
21
+ s.add_dependency 'faraday-mashify'
22
+ s.add_dependency 'faraday-multipart'
21
23
  s.add_dependency 'gli'
22
24
  s.add_dependency 'hashie'
23
25
  s.add_dependency 'websocket-driver'
24
- s.add_development_dependency 'activesupport'
25
- s.add_development_dependency 'erubis'
26
- s.add_development_dependency 'json-schema'
27
- s.add_development_dependency 'rake', '~> 13'
28
- s.add_development_dependency 'rspec'
29
- s.add_development_dependency 'rubocop', '~> 0.93.1'
30
- s.add_development_dependency 'rubocop-performance', '~> 1.5.2'
31
- s.add_development_dependency 'rubocop-rspec', '~> 1.39.0'
32
- s.add_development_dependency 'timecop'
33
- s.add_development_dependency 'vcr'
34
- s.add_development_dependency 'webmock'
26
+ s.metadata['rubygems_mfa_required'] = 'true'
35
27
  end
@@ -182,7 +182,7 @@ RSpec.describe 'integration test', skip: ( # rubocop:disable RSpec/DescribeClass
182
182
  start_server
183
183
  wait_for_server
184
184
 
185
- expect(@reply_to).to be nil
185
+ expect(@reply_to).to be_nil
186
186
  end
187
187
  end
188
188
 
@@ -18,7 +18,7 @@ RSpec.describe Slack::Events::Request do
18
18
  let(:timestamp) { '1547933148' }
19
19
  let(:body) do
20
20
  '{"token":"X34FAqCu8tmGEkEEpoDncnja","challenge":' \
21
- '"P7sFXA4o3HV2hTx4zb4zcQ9yrvuQs8pDh6EacOxmMRj0tJaXfQFF","type":"url_verification"}'
21
+ '"P7sFXA4o3HV2hTx4zb4zcQ9yrvuQs8pDh6EacOxmMRj0tJaXfQFF","type":"url_verification"}'
22
22
  end
23
23
  let(:http_request) do
24
24
  request_double = double(