diff --git a/CHANGELOG.md b/CHANGELOG.md index f05491a0..d8d70375 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ### 0.13.2 (Next) * [#226](https://github.com/slack-ruby/slack-ruby-client/pull/226), [#232](https://github.com/slack-ruby/slack-ruby-client/pull/232), [#236](https://github.com/slack-ruby/slack-ruby-client/pull/236), [#234](https://github.com/slack-ruby/slack-ruby-client/pull/234): Added periodic ping that reconnects on failure - [@RodneyU215](https://github.com/RodneyU215), [@dblock](https://github.com/dblock), [@ioquatix](https://github.com/ioquatix). +* [#242](https://github.com/slack-ruby/slack-ruby-client/pull/242): Added `thread_ts` option to `chat_postEphemeral` - [@dblock](https://github.com/dblock). +* [#242](https://github.com/slack-ruby/slack-ruby-client/pull/242): Added `apps_uninstall` to Web API - [@dblock](https://github.com/dblock). * Your contribution here. ### 0.13.1 (2018/9/30) diff --git a/bin/commands.rb b/bin/commands.rb index b70b4bd8..50ad61ab 100644 --- a/bin/commands.rb +++ b/bin/commands.rb @@ -1,6 +1,7 @@ # This file was auto-generated by lib/tasks/web.rake require 'commands/api' +require 'commands/apps' require 'commands/apps_permissions' require 'commands/apps_permissions_resources' require 'commands/apps_permissions_scopes' diff --git a/bin/commands/apps.rb b/bin/commands/apps.rb new file mode 100644 index 00000000..3843b973 --- /dev/null +++ b/bin/commands/apps.rb @@ -0,0 +1,14 @@ +# This file was auto-generated by lib/tasks/web.rake + +desc 'Apps methods.' +command 'apps' do |g| + g.desc 'Uninstalls your app from a workspace.' + g.long_desc %( Uninstalls your app from a workspace. ) + g.command 'uninstall' do |c| + c.flag 'client_id', desc: 'Issued when you created your application.' + c.flag 'client_secret', desc: 'Issued when you created your application.' + c.action do |_global_options, options, _args| + puts JSON.dump($client.apps_uninstall(options)) + end + end +end diff --git a/bin/commands/chat.rb b/bin/commands/chat.rb index 97f9eb01..e03529c9 100644 --- a/bin/commands/chat.rb +++ b/bin/commands/chat.rb @@ -50,10 +50,11 @@ c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.' c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead." c.flag 'user', desc: 'id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.' - c.flag 'as_user', desc: 'Pass true to post the message as the authed bot. Defaults to false.' + c.flag 'as_user', desc: 'Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.' c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.' c.flag 'link_names', desc: 'Find and link channel names and usernames.' c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.' + c.flag 'thread_ts', desc: "Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead." c.action do |_global_options, options, _args| puts JSON.dump($client.chat_postEphemeral(options)) end diff --git a/bin/commands/files.rb b/bin/commands/files.rb index 2d824560..3bfb0e90 100644 --- a/bin/commands/files.rb +++ b/bin/commands/files.rb @@ -40,17 +40,16 @@ c.flag 'ts_from', desc: 'Filter files created after this timestamp (inclusive).' c.flag 'ts_to', desc: 'Filter files created before this timestamp (inclusive).' c.flag 'types', desc: 'Filter files by type: +* `all` - All files +* `spaces` - Posts +* `snippets` - Snippets +* `images` - Image files +* `gdocs` - Google docs +* `zips` - Zip files +* `pdfs` - PDF files -all - All files -spaces - Posts -snippets - Snippets -images - Image files -gdocs - Google docs -zips - Zip files -pdfs - PDF files +You can pass multiple values in the types argument, like `types=spaces,snippets`.The default value is `all`, which does not filter the list. - -You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list. .' c.flag 'user', desc: 'Filter files created by a single user.' c.action do |_global_options, options, _args| diff --git a/bin/commands/reactions.rb b/bin/commands/reactions.rb index e48bf22e..485efa7c 100644 --- a/bin/commands/reactions.rb +++ b/bin/commands/reactions.rb @@ -7,8 +7,8 @@ g.command 'add' do |c| c.flag 'name', desc: 'Reaction (emoji) name.' c.flag 'channel', desc: 'Channel where the message to add reaction to was posted.' - c.flag 'file', desc: 'File to add reaction to.' - c.flag 'file_comment', desc: 'File comment to add reaction to.' + c.flag 'file', desc: "File to add reaction to. Now that file threads work the way you'd expect, this argument is deprecated. Specify the timestamp and channel of the message associated with a file instead." + c.flag 'file_comment', desc: "File comment to add reaction to. Now that file threads work the way you'd expect, this argument is deprecated. Specify the timestamp and channel of the message associated with a file instead." c.flag 'timestamp', desc: 'Timestamp of the message to add reaction to.' c.action do |_global_options, options, _args| puts JSON.dump($client.reactions_add(options)) diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index 2d7b2c81..973f6a9b 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -1,6 +1,7 @@ # This file was auto-generated by lib/tasks/web.rake require_relative 'endpoints/api' +require_relative 'endpoints/apps' require_relative 'endpoints/apps_permissions' require_relative 'endpoints/apps_permissions_resources' require_relative 'endpoints/apps_permissions_scopes' @@ -44,6 +45,7 @@ module Endpoints include Slack::Web::Api::Mixins::Groups include Api + include Apps include AppsPermissions include AppsPermissionsResources include AppsPermissionsScopes diff --git a/lib/slack/web/api/endpoints/apps.rb b/lib/slack/web/api/endpoints/apps.rb new file mode 100644 index 00000000..0c670b6c --- /dev/null +++ b/lib/slack/web/api/endpoints/apps.rb @@ -0,0 +1,26 @@ +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module Apps + # + # Uninstalls your app from a workspace. + # + # @option options [Object] :client_id + # Issued when you created your application. + # @option options [Object] :client_secret + # Issued when you created your application. + # @see https://api.slack.com/methods/apps.uninstall + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps/apps.uninstall.json + def apps_uninstall(options = {}) + throw ArgumentError.new('Required arguments :client_id missing') if options[:client_id].nil? + throw ArgumentError.new('Required arguments :client_secret missing') if options[:client_secret].nil? + post('apps.uninstall', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb index 194419eb..9f0ee035 100644 --- a/lib/slack/web/api/endpoints/chat.rb +++ b/lib/slack/web/api/endpoints/chat.rb @@ -82,13 +82,15 @@ def chat_meMessage(options = {}) # @option options [user] :user # id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument. # @option options [Object] :as_user - # Pass true to post the message as the authed bot. Defaults to false. + # Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false. # @option options [Object] :attachments # A JSON-based array of structured attachments, presented as a URL-encoded string. # @option options [Object] :link_names # Find and link channel names and usernames. # @option options [Object] :parse # Change how messages are treated. Defaults to none. See below. + # @option options [Object] :thread_ts + # Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead. # @see https://api.slack.com/methods/chat.postEphemeral # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json def chat_postEphemeral(options = {}) diff --git a/lib/slack/web/api/endpoints/files.rb b/lib/slack/web/api/endpoints/files.rb index fcac78c9..baee9103 100644 --- a/lib/slack/web/api/endpoints/files.rb +++ b/lib/slack/web/api/endpoints/files.rb @@ -67,17 +67,16 @@ def files_info(options = {}) # Filter files created before this timestamp (inclusive). # @option options [Object] :types # Filter files by type: + # * `all` - All files + # * `spaces` - Posts + # * `snippets` - Snippets + # * `images` - Image files + # * `gdocs` - Google docs + # * `zips` - Zip files + # * `pdfs` - PDF files # - # all - All files - # spaces - Posts - # snippets - Snippets - # images - Image files - # gdocs - Google docs - # zips - Zip files - # pdfs - PDF files + # You can pass multiple values in the types argument, like `types=spaces,snippets`.The default value is `all`, which does not filter the list. # - # - # You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list. # . # @option options [user] :user # Filter files created by a single user. diff --git a/lib/slack/web/api/endpoints/reactions.rb b/lib/slack/web/api/endpoints/reactions.rb index 1817dced..e3804108 100644 --- a/lib/slack/web/api/endpoints/reactions.rb +++ b/lib/slack/web/api/endpoints/reactions.rb @@ -13,9 +13,9 @@ module Reactions # @option options [channel] :channel # Channel where the message to add reaction to was posted. # @option options [file] :file - # File to add reaction to. + # File to add reaction to. Now that file threads work the way you'd expect, this argument is deprecated. Specify the timestamp and channel of the message associated with a file instead. # @option options [Object] :file_comment - # File comment to add reaction to. + # File comment to add reaction to. Now that file threads work the way you'd expect, this argument is deprecated. Specify the timestamp and channel of the message associated with a file instead. # @option options [Object] :timestamp # Timestamp of the message to add reaction to. # @see https://api.slack.com/methods/reactions.add diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index 5fbbebd3..2fc7a696 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 5fbbebd33474030ce62b8f0dae8c913ddc24aeed +Subproject commit 2fc7a6964fe39d04b1fbd96c5373d668e60c76bd diff --git a/spec/slack/web/api/endpoints/apps_spec.rb b/spec/slack/web/api/endpoints/apps_spec.rb new file mode 100644 index 00000000..bc065704 --- /dev/null +++ b/spec/slack/web/api/endpoints/apps_spec.rb @@ -0,0 +1,15 @@ +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::Apps do + let(:client) { Slack::Web::Client.new } + context 'apps_uninstall' do + it 'requires client_id' do + expect { client.apps_uninstall(client_secret: 'f25b5ceaf8a3c2a2c4f52bb4f0b0499e') }.to raise_error ArgumentError, /Required arguments :client_id missing/ + end + it 'requires client_secret' do + expect { client.apps_uninstall(client_id: '56579136444.26251006572') }.to raise_error ArgumentError, /Required arguments :client_secret missing/ + end + end +end