Skip to content

Commit

Permalink
Added thread_ts option to chat_postEphemeral.
Browse files Browse the repository at this point in the history
Added apps_uninstall to Web API.
  • Loading branch information
dblock committed Dec 28, 2018
1 parent 9c2bf64 commit 1bb716b
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 25 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 1 addition & 0 deletions bin/commands.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
14 changes: 14 additions & 0 deletions bin/commands/apps.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion bin/commands/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 8 additions & 9 deletions bin/commands/files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
4 changes: 2 additions & 2 deletions bin/commands/reactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions lib/slack/web/api/endpoints.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -44,6 +45,7 @@ module Endpoints
include Slack::Web::Api::Mixins::Groups

include Api
include Apps
include AppsPermissions
include AppsPermissionsResources
include AppsPermissionsScopes
Expand Down
26 changes: 26 additions & 0 deletions lib/slack/web/api/endpoints/apps.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion lib/slack/web/api/endpoints/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down
17 changes: 8 additions & 9 deletions lib/slack/web/api/endpoints/files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions lib/slack/web/api/endpoints/reactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions spec/slack/web/api/endpoints/apps_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1bb716b

Please sign in to comment.