Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### 0.11.2 (Next)

* Your contribution here.
* [#207](https://github.com/slack-ruby/slack-ruby-client/pull/207): Added `apps_permissions_resources_list` and `apps_permissions_scopes_list` - [@jmanian](https://github.com/jmanian).
* [#207](https://github.com/slack-ruby/slack-ruby-client/pull/207): Added `users_conversations` - [@jmanian](https://github.com/jmanian).
* [#206](https://github.com/slack-ruby/slack-ruby-client/pull/206): Fix 100% cpu usage in async examples - [@felixbuenemann](https://github.com/felixbuenemann).

### 0.11.1 (1/23/2017)
Expand Down
2 changes: 2 additions & 0 deletions bin/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

require 'commands/api'
require 'commands/apps_permissions'
require 'commands/apps_permissions_resources'
require 'commands/apps_permissions_scopes'
require 'commands/auth'
require 'commands/bots'
require 'commands/channels'
Expand Down
14 changes: 14 additions & 0 deletions bin/commands/apps_permissions_resources.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 'AppsPermissionsResources methods.'
command 'apps_permissions_resources' do |g|
g.desc 'Returns list of resource grants this app has on a team.'
g.long_desc %( Returns list of resource grants this app has on a team. )
g.command 'list' do |c|
c.flag 'cursor', desc: "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."
c.flag 'limit', desc: 'The maximum number of items to return.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.apps_permissions_resources_list(options))
end
end
end
12 changes: 12 additions & 0 deletions bin/commands/apps_permissions_scopes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file was auto-generated by lib/tasks/web.rake

desc 'AppsPermissionsScopes methods.'
command 'apps_permissions_scopes' do |g|
g.desc 'Returns list of scopes this app has on a team.'
g.long_desc %( Returns list of scopes this app has on a team. )
g.command 'list' do |c|
c.action do |_global_options, options, _args|
puts JSON.dump($client.apps_permissions_scopes_list(options))
end
end
end
5 changes: 3 additions & 2 deletions bin/commands/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@
g.long_desc %( Sends a message to a channel. )
g.command 'postMessage' do |c|
c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.'
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 '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. Provide no more than 40,000 characters or risk truncation."
c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.'
c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
c.flag 'link_names', desc: 'Find and link channel names and usernames.'
c.flag 'mrkdwn', desc: 'Disable Slack markup parsing by setting to false. Enabled by default.'
c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.'
c.flag 'reply_broadcast', desc: 'Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.'
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."
Expand Down Expand Up @@ -102,7 +103,7 @@
c.flag 'ts', desc: 'Timestamp of the message to be updated.'
c.flag 'as_user', desc: 'Pass true to update the message as the authed user. Bot users in this context are considered authed users.'
c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text.'
c.flag 'link_names', desc: 'Find and link channel names and usernames. Defaults to none. This parameter should be used in conjunction with parse. To set link_names to 1, specify a parse mode of full.'
c.flag 'link_names', desc: 'Find and link channel names and usernames. Defaults to none. See below.'
c.flag 'parse', desc: 'Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.chat_update(options))
Expand Down
5 changes: 3 additions & 2 deletions bin/commands/oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

desc 'Oauth methods.'
command 'oauth' do |g|
g.desc 'Exchanges a temporary OAuth code for an API token.'
g.long_desc %( Exchanges a temporary OAuth code for an API token. )
g.desc 'Exchanges a temporary OAuth verifier code for an access token.'
g.long_desc %( Exchanges a temporary OAuth verifier code for an access token. )
g.command 'access' 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.flag 'code', desc: 'The code param returned via the OAuth callback.'
c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).'
c.flag 'single_channel', desc: 'Request the user to add your app only to a single channel.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.oauth_access(options))
end
Expand Down
6 changes: 4 additions & 2 deletions bin/commands/rtm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
g.desc 'Starts a Real Time Messaging session.'
g.long_desc %( Starts a Real Time Messaging session. )
g.command 'connect' do |c|
c.flag 'batch_presence_aware', desc: 'Only deliver presence events when requested by subscription. See presence subscriptions.'
c.flag 'batch_presence_aware', desc: 'Batch presence deliveries via subscription. Enabling changes the shape of presence_change events. See batch presence.'
c.flag 'presence_sub', desc: 'Only deliver presence events when requested by subscription. See presence subscriptions.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.rtm_connect(options))
end
Expand All @@ -14,11 +15,12 @@
g.desc 'Starts a Real Time Messaging session.'
g.long_desc %( Starts a Real Time Messaging session. )
g.command 'start' do |c|
c.flag 'batch_presence_aware', desc: 'Only deliver presence events when requested by subscription. See presence subscriptions.'
c.flag 'batch_presence_aware', desc: 'Batch presence deliveries via subscription. Enabling changes the shape of presence_change events. See batch presence.'
c.flag 'include_locale', desc: 'Set this to true to receive the locale for users and channels. Defaults to false.'
c.flag 'mpim_aware', desc: 'Returns MPIMs to the client in the API response.'
c.flag 'no_latest', desc: 'Exclude latest timestamps for channels, groups, mpims, and ims. Automatically sets no_unreads to 1.'
c.flag 'no_unreads', desc: 'Skip unread counts for each channel (improves performance).'
c.flag 'presence_sub', desc: 'Only deliver presence events when requested by subscription. See presence subscriptions.'
c.flag 'simple_latest', desc: 'Return timestamp only for latest message object of each channel (improves performance).'
c.action do |_global_options, options, _args|
puts JSON.dump($client.rtm_start(options))
Expand Down
4 changes: 2 additions & 2 deletions bin/commands/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
g.desc 'Searches for files matching a query.'
g.long_desc %( Searches for files matching a query. )
g.command 'files' do |c|
c.flag 'query', desc: 'Search query. May contain booleans, etc.'
c.flag 'query', desc: 'Search query.'
c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
Expand All @@ -29,7 +29,7 @@
g.desc 'Searches for messages matching a query.'
g.long_desc %( Searches for messages matching a query. )
g.command 'messages' do |c|
c.flag 'query', desc: 'Search query. May contains booleans, etc.'
c.flag 'query', desc: 'Search query.'
c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
Expand Down
19 changes: 16 additions & 3 deletions bin/commands/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

desc 'Get info on members of your Slack team.'
command 'users' do |g|
g.desc 'List conversations the calling user may access.'
g.long_desc %( List conversations the calling user may access. )
g.command 'conversations' do |c|
c.flag 'cursor', desc: "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."
c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
c.flag 'limit', desc: "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. Must be an integer no larger than 1000."
c.flag 'types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.'
c.flag 'user', desc: "Browse conversations by a specific user ID's membership. Non-public channels are restricted to those where the calling user shares membership."
c.action do |_global_options, options, _args|
puts JSON.dump($client.users_conversations(options))
end
end

g.desc 'Delete the user profile photo'
g.long_desc %( Delete the user profile photo )
g.command 'deletePhoto' do |c|
Expand Down Expand Up @@ -52,7 +65,7 @@
c.flag 'cursor', desc: "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."
c.flag 'include_locale', desc: 'Set this to true to receive the locale for users. Defaults to false.'
c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
c.flag 'presence', desc: 'Whether to include presence data in the output. Defaults to false. Setting this to true reduces performance, especially with large teams.'
c.flag 'presence', desc: 'Deprecated. Whether to include presence data in the output. Defaults to false. Setting this to true reduces performance, especially with large teams.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.users_list(options))
end
Expand All @@ -76,8 +89,8 @@
end
end

g.desc 'Marks a user as active.'
g.long_desc %( Marks a user as active. )
g.desc 'Marked a user as active. Deprecated and non-functional.'
g.long_desc %( Marked a user as active. Deprecated and non-functional. )
g.command 'setActive' do |c|
c.action do |_global_options, options, _args|
puts JSON.dump($client.users_setActive(options))
Expand Down
5 changes: 5 additions & 0 deletions lib/slack/real_time/stores/starter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ def initialize(attrs)

### RealTime Events

# Determine the current presence status for a list of users.
# @see https://api.slack.com/events/presence_query
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/presence_query.json
# on :presence_query do |data|

# The membership of an existing User Group has changed.
# @see https://api.slack.com/events/subteam_members_changed
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_members_changed.json
Expand Down
5 changes: 5 additions & 0 deletions lib/slack/real_time/stores/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def initialize(attrs)

### RealTime Events

# Determine the current presence status for a list of users.
# @see https://api.slack.com/events/presence_query
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/presence_query.json
# on :presence_query do |data|

# The membership of an existing User Group has changed.
# @see https://api.slack.com/events/subteam_members_changed
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_members_changed.json
Expand Down
4 changes: 4 additions & 0 deletions lib/slack/web/api/endpoints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

require_relative 'endpoints/api'
require_relative 'endpoints/apps_permissions'
require_relative 'endpoints/apps_permissions_resources'
require_relative 'endpoints/apps_permissions_scopes'
require_relative 'endpoints/auth'
require_relative 'endpoints/bots'
require_relative 'endpoints/channels'
Expand Down Expand Up @@ -42,6 +44,8 @@ module Endpoints

include Api
include AppsPermissions
include AppsPermissionsResources
include AppsPermissionsScopes
include Auth
include Bots
include Channels
Expand Down
30 changes: 30 additions & 0 deletions lib/slack/web/api/endpoints/apps_permissions_resources.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file was auto-generated by lib/tasks/web.rake

module Slack
module Web
module Api
module Endpoints
module AppsPermissionsResources
#
# Returns list of resource grants this app has on a team.
#
# @option options [Object] :cursor
# 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.
# @option options [Object] :limit
# The maximum number of items to return.
# @see https://api.slack.com/methods/apps.permissions.resources.list
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.resources/apps.permissions.resources.list.json
def apps_permissions_resources_list(options = {})
if block_given?
Pagination::Cursor.new(self, :apps_permissions_resources_list, options).each do |page|
yield page
end
else
post('apps.permissions.resources.list', options)
end
end
end
end
end
end
end
20 changes: 20 additions & 0 deletions lib/slack/web/api/endpoints/apps_permissions_scopes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was auto-generated by lib/tasks/web.rake

module Slack
module Web
module Api
module Endpoints
module AppsPermissionsScopes
#
# Returns list of scopes this app has on a team.
#
# @see https://api.slack.com/methods/apps.permissions.scopes.list
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.scopes/apps.permissions.scopes.list.json
def apps_permissions_scopes_list(options = {})
post('apps.permissions.scopes.list', options)
end
end
end
end
end
end
6 changes: 4 additions & 2 deletions lib/slack/web/api/endpoints/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def chat_postEphemeral(options = {})
# @option options [channel] :channel
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
# @option options [Object] :text
# 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.
# 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. Provide no more than 40,000 characters or risk truncation.
# @option options [Object] :as_user
# Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
# @option options [Object] :attachments
Expand All @@ -122,6 +122,8 @@ def chat_postEphemeral(options = {})
# URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
# @option options [Object] :link_names
# Find and link channel names and usernames.
# @option options [Object] :mrkdwn
# Disable Slack markup parsing by setting to false. Enabled by default.
# @option options [Object] :parse
# Change how messages are treated. Defaults to none. See below.
# @option options [Object] :reply_broadcast
Expand Down Expand Up @@ -187,7 +189,7 @@ def chat_unfurl(options = {})
# @option options [Object] :attachments
# A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text.
# @option options [Object] :link_names
# Find and link channel names and usernames. Defaults to none. This parameter should be used in conjunction with parse. To set link_names to 1, specify a parse mode of full.
# Find and link channel names and usernames. Defaults to none. See below.
# @option options [Object] :parse
# Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
# @see https://api.slack.com/methods/chat.update
Expand Down
4 changes: 3 additions & 1 deletion lib/slack/web/api/endpoints/oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Api
module Endpoints
module Oauth
#
# Exchanges a temporary OAuth code for an API token.
# Exchanges a temporary OAuth verifier code for an access token.
#
# @option options [Object] :client_id
# Issued when you created your application.
Expand All @@ -16,6 +16,8 @@ module Oauth
# The code param returned via the OAuth callback.
# @option options [Object] :redirect_uri
# This must match the originally submitted URI (if one was sent).
# @option options [Object] :single_channel
# Request the user to add your app only to a single channel.
# @see https://api.slack.com/methods/oauth.access
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth/oauth.access.json
def oauth_access(options = {})
Expand Down
Loading