slack-ruby-client 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/{integtest.yml → integration_test.yml} +6 -5
- data/.github/workflows/{rubocop.yml → lint.yml} +5 -4
- data/.github/workflows/{danger.yml → pr_lint.yml} +8 -6
- data/.github/workflows/test.yml +4 -2
- data/.gitignore +0 -1
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +8 -14
- data/.ruby-version +1 -0
- data/CHANGELOG.md +14 -0
- data/CONTRIBUTING.md +5 -4
- data/Gemfile +1 -6
- data/README.md +60 -63
- data/RELEASING.md +1 -1
- data/UPGRADING.md +28 -0
- data/bin/commands/admin_audit_anomaly_allow.rb +23 -0
- data/bin/commands/admin_conversations.rb +12 -11
- data/bin/commands/admin_users.rb +1 -1
- data/bin/commands/admin_users_session.rb +1 -1
- data/bin/commands/apps_connections.rb +2 -2
- data/bin/commands/bookmarks.rb +1 -0
- data/bin/commands/chat.rb +9 -6
- data/bin/commands/conversations.rb +8 -6
- data/bin/commands/files.rb +24 -0
- data/bin/commands/rtm.rb +0 -15
- data/bin/commands/views.rb +4 -2
- data/bin/commands.rb +1 -0
- data/bin/slack +1 -1
- data/lib/slack/real_time/api/message.rb +3 -2
- data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
- data/lib/slack/real_time/api/typing.rb +2 -1
- data/lib/slack/real_time/client.rb +8 -26
- data/lib/slack/real_time/config.rb +3 -3
- data/lib/slack/real_time/models/channel.rb +4 -0
- data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
- data/lib/slack/real_time/models.rb +2 -1
- data/lib/slack/real_time/stores/base.rb +25 -9
- data/lib/slack/real_time/stores/starter.rb +323 -309
- data/lib/slack/real_time/stores/store.rb +265 -198
- data/lib/slack/real_time/stores.rb +1 -7
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
- data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_conversations.rb +30 -28
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
- data/lib/slack/web/api/endpoints/admin_emoji.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
- data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
- data/lib/slack/web/api/endpoints/apps.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_manifest.rb +6 -6
- data/lib/slack/web/api/endpoints/bookmarks.rb +10 -8
- data/lib/slack/web/api/endpoints/bots.rb +1 -1
- data/lib/slack/web/api/endpoints/calls.rb +5 -5
- data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
- data/lib/slack/web/api/endpoints/chat.rb +36 -30
- data/lib/slack/web/api/endpoints/conversations.rb +37 -33
- data/lib/slack/web/api/endpoints/dialog.rb +2 -2
- data/lib/slack/web/api/endpoints/dnd.rb +1 -1
- data/lib/slack/web/api/endpoints/files.rb +45 -8
- data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
- data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
- data/lib/slack/web/api/endpoints/migration.rb +1 -1
- data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
- data/lib/slack/web/api/endpoints/pins.rb +3 -3
- data/lib/slack/web/api/endpoints/reactions.rb +4 -4
- data/lib/slack/web/api/endpoints/reminders.rb +5 -5
- data/lib/slack/web/api/endpoints/rtm.rb +0 -23
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +4 -4
- data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
- data/lib/slack/web/api/endpoints/users.rb +4 -4
- data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
- data/lib/slack/web/api/endpoints/views.rb +16 -11
- data/lib/slack/web/api/endpoints/workflows.rb +4 -4
- data/lib/slack/web/api/endpoints.rb +2 -0
- data/lib/slack/web/api/errors.rb +56 -6
- data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.search.rb +2 -1
- data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
- data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
- data/lib/slack/web/api/patches/views.view-json.patch +55 -0
- data/lib/slack/web/api/templates/method.erb +1 -1
- data/lib/slack/web/config.rb +2 -2
- data/lib/tasks/real_time.rake +44 -22
- data/lib/tasks/web.rake +9 -2
- data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
- data/spec/slack/events/config_spec.rb +2 -0
- data/spec/slack/events/request_spec.rb +4 -0
- data/spec/slack/messages/formatting_spec.rb +10 -0
- data/spec/slack/real_time/api/message_spec.rb +1 -1
- data/spec/slack/real_time/api/ping_spec.rb +1 -1
- data/spec/slack/real_time/api/typing_spec.rb +1 -1
- data/spec/slack/real_time/client_spec.rb +73 -111
- data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/im_spec.rb +28 -25
- data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
- data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +24 -20
- data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
- data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
- data/spec/slack/real_time/stores/store_spec.rb +50 -0
- data/spec/slack/slack_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +17 -1
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +2 -0
- data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +13 -4
- data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
- data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
- data/spec/slack/web/api/mixins/users_spec.rb +2 -0
- data/spec/slack/web/api/pagination/cursor_spec.rb +4 -0
- data/spec/slack/web/client_spec.rb +14 -4
- data/spec/support/real_time/loaded_client.rb +120 -0
- metadata +18 -35
- data/bin/commands/admin_conversations_whitelist.rb +0 -37
- data/bin/commands/apps_permissions.rb +0 -23
- data/bin/commands/apps_permissions_resources.rb +0 -15
- data/bin/commands/apps_permissions_scopes.rb +0 -13
- data/bin/commands/apps_permissions_users.rb +0 -26
- data/bin/commands/channels.rb +0 -23
- data/bin/commands/groups.rb +0 -14
- data/bin/commands/im.rb +0 -6
- data/bin/commands/mpim.rb +0 -6
- data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
- data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
- data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
- data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
- data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
- data/lib/slack/web/api/endpoints/channels.rb +0 -25
- data/lib/slack/web/api/endpoints/groups.rb +0 -13
- data/lib/slack/web/api/endpoints/im.rb +0 -13
- data/lib/slack/web/api/endpoints/mpim.rb +0 -13
- data/lib/slack/web/api/endpoints/presence.rb +0 -23
- data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
- data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
- data/spec/fixtures/slack/web/rtm_start.yml +0 -815
- data/spec/slack/real_time/rtm_start_spec.rb +0 -14
- data/spec/slack/real_time/store_spec.rb +0 -12
@@ -1,50 +0,0 @@
|
|
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 AppsPermissionsUsers
|
9
|
-
#
|
10
|
-
# Returns list of user grants and corresponding scopes this app has on a team.
|
11
|
-
#
|
12
|
-
# @option options [Object] :cursor
|
13
|
-
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
|
14
|
-
# @option options [Object] :limit
|
15
|
-
# The maximum number of items to return.
|
16
|
-
# @see https://api.slack.com/methods/apps.permissions.users.list
|
17
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.users/apps.permissions.users.list.json
|
18
|
-
def apps_permissions_users_list(options = {})
|
19
|
-
if block_given?
|
20
|
-
Pagination::Cursor.new(self, :apps_permissions_users_list, options).each do |page|
|
21
|
-
yield page
|
22
|
-
end
|
23
|
-
else
|
24
|
-
post('apps.permissions.users.list', options)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
#
|
29
|
-
# Enables an app to trigger a permissions modal to grant an app access to a user access scope.
|
30
|
-
#
|
31
|
-
# @option options [Object] :scopes
|
32
|
-
# A comma separated list of user scopes to request for.
|
33
|
-
# @option options [Object] :trigger_id
|
34
|
-
# Token used to trigger the request.
|
35
|
-
# @option options [user] :user
|
36
|
-
# The user this scope is being requested for.
|
37
|
-
# @see https://api.slack.com/methods/apps.permissions.users.request
|
38
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.users/apps.permissions.users.request.json
|
39
|
-
def apps_permissions_users_request(options = {})
|
40
|
-
throw ArgumentError.new('Required arguments :scopes missing') if options[:scopes].nil?
|
41
|
-
throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
|
42
|
-
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
43
|
-
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
44
|
-
post('apps.permissions.users.request', options)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,25 +0,0 @@
|
|
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 Channels
|
9
|
-
#
|
10
|
-
# Delete a channel (undocumented)
|
11
|
-
#
|
12
|
-
# @option options [channel] :channel
|
13
|
-
# Channel to delete.
|
14
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/channels/channels.delete.json
|
15
|
-
def channels_delete(options = {})
|
16
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
17
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
18
|
-
logger.warn('The channels.delete method is undocumented.')
|
19
|
-
post('channels.delete', options)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/slack/web/api/tasks/generate.rake
|
2
|
-
|
3
|
-
module Slack
|
4
|
-
module Web
|
5
|
-
module Api
|
6
|
-
module Endpoints
|
7
|
-
module Presence
|
8
|
-
#
|
9
|
-
# Manually set user presence.
|
10
|
-
#
|
11
|
-
# @option options [Object] :presence
|
12
|
-
# Either `active` or `away`.
|
13
|
-
# @see https://api.slack.com/methods/presence.set
|
14
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/presence.set.json
|
15
|
-
def presence_set(options = {})
|
16
|
-
throw ArgumentError.new('Required arguments :presence missing') if options[:presence].nil?
|
17
|
-
post('presence.set', options)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
diff --git a/lib/slack/web/api/endpoints/views.rb b/lib/slack/web/api/endpoints/views.rb
|
2
|
-
index 3d7ac8e..10de15c 100644
|
3
|
-
--- a/lib/slack/web/api/endpoints/views.rb
|
4
|
-
+++ b/lib/slack/web/api/endpoints/views.rb
|
5
|
-
@@ -18,6 +18,11 @@ module Slack
|
6
|
-
def views_open(options = {})
|
7
|
-
throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
|
8
|
-
throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
|
9
|
-
+ if options.key?(:view)
|
10
|
-
+ view = options[:view]
|
11
|
-
+ view = JSON.dump(view) unless view.is_a?(String)
|
12
|
-
+ options = options.merge(view: view)
|
13
|
-
+ end
|
14
|
-
post('views.open', options)
|
15
|
-
end
|
16
|
-
|
17
|
-
@@ -33,6 +38,11 @@ module Slack
|
18
|
-
def views_push(options = {})
|
19
|
-
throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
|
20
|
-
throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
|
21
|
-
+ if options.key?(:view)
|
22
|
-
+ view = options[:view]
|
23
|
-
+ view = JSON.dump(view) unless view.is_a?(String)
|
24
|
-
+ options = options.merge(view: view)
|
25
|
-
+ end
|
26
|
-
post('views.push', options)
|
27
|
-
end
|
28
|
-
|
29
|
-
@@ -51,6 +61,11 @@ module Slack
|
30
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.update.json
|
31
|
-
def views_update(options = {})
|
32
|
-
throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
|
33
|
-
+ if options.key?(:view)
|
34
|
-
+ view = options[:view]
|
35
|
-
+ view = JSON.dump(view) unless view.is_a?(String)
|
36
|
-
+ options = options.merge(view: view)
|
37
|
-
+ end
|
38
|
-
post('views.update', options)
|
39
|
-
end
|
40
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
diff --git a/lib/slack/web/api/endpoints/views.rb b/lib/slack/web/api/endpoints/views.rb
|
2
|
-
index 31626b9..8182a9c 100644
|
3
|
-
--- a/lib/slack/web/api/endpoints/views.rb
|
4
|
-
+++ b/lib/slack/web/api/endpoints/views.rb
|
5
|
-
@@ -40,6 +40,11 @@ module Slack
|
6
|
-
def views_publish(options = {})
|
7
|
-
throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
|
8
|
-
throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
|
9
|
-
+ if options.key?(:view)
|
10
|
-
+ view = options[:view]
|
11
|
-
+ view = JSON.dump(view) unless view.is_a?(String)
|
12
|
-
+ options = options.merge(view: view)
|
13
|
-
+ end
|
14
|
-
post('views.publish', options)
|
15
|
-
end
|
16
|
-
|