Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update API methods from slack-api-ref #196

Merged
merged 1 commit into from Jan 22, 2018
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* [#187](https://github.com/slack-ruby/slack-ruby-client/pull/187): Concatenate error message when multiple errors present - [@chrislopresto](https://github.com/chrislopresto).
* [#188](https://github.com/slack-ruby/slack-ruby-client/pull/188): Fixed `NoMethodError` when Slack is unavailable - [@sonicdoe](https://github.com/sonicdoe).
* [#196](https://github.com/slack-ruby/slack-ruby-client/pull/196): Added `users_lookupByEmail` - [@manuelmeurer](https://github.com/manuelmeurer).
* Your contribution here.

### 0.11.0 (11/25/2017)
Expand Down
4 changes: 4 additions & 0 deletions bin/commands/conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
g.command 'history' do |c|
c.flag 'channel', desc: 'Conversation ID to fetch history for.'
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 'inclusive', desc: 'Include messages with latest or oldest timestamp in results only when either timestamp is specified.'
c.flag 'latest', desc: 'End of time range of messages to include in results.'
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 'oldest', desc: 'Start of time range of messages to include in results.'
Expand Down Expand Up @@ -141,7 +142,10 @@
c.flag 'channel', desc: 'Conversation ID to fetch thread from.'
c.flag 'ts', desc: "Unique identifier of a thread's parent message."
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 'inclusive', desc: 'Include messages with latest or oldest timestamp in results only when either timestamp is specified.'
c.flag 'latest', desc: 'End of time range of messages to include in results.'
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 'oldest', desc: 'Start of time range of messages to include in results.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.conversations_replies(options))
end
Expand Down
11 changes: 10 additions & 1 deletion bin/commands/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,21 @@
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. Setting this to false improves performance, especially with large teams.'
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.action do |_global_options, options, _args|
puts JSON.dump($client.users_list(options))
end
end

g.desc 'Find a user with an email address.'
g.long_desc %( Find a user with an email address. )
g.command 'lookupByEmail' do |c|
c.flag 'email', desc: 'An email address belonging to a user in the workspace.'
c.action do |_global_options, options, _args|
puts JSON.dump($client.users_lookupByEmail(options))
end
end

g.desc 'This method searches for users.'
g.long_desc %( This method searches for users. )
g.command 'search' do |c|
Expand Down
8 changes: 8 additions & 0 deletions lib/slack/web/api/endpoints/conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def conversations_create(options = {})
# Conversation ID to fetch history for.
# @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] :inclusive
# Include messages with latest or oldest timestamp in results only when either timestamp is specified.
# @option options [timestamp] :latest
# End of time range of messages to include in results.
# @option options [Object] :limit
Expand Down Expand Up @@ -233,8 +235,14 @@ def conversations_rename(options = {})
# Unique identifier of a thread's parent message.
# @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] :inclusive
# Include messages with latest or oldest timestamp in results only when either timestamp is specified.
# @option options [timestamp] :latest
# End of time range of messages to include in results.
# @option options [Object] :limit
# 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.
# @option options [timestamp] :oldest
# Start of time range of messages to include in results.
# @see https://api.slack.com/methods/conversations.replies
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.replies.json
def conversations_replies(options = {})
Expand Down
14 changes: 13 additions & 1 deletion lib/slack/web/api/endpoints/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def users_info(options = {})
# @option options [Object] :limit
# 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.
# @option options [Object] :presence
# Whether to include presence data in the output. Setting this to false improves performance, especially with large teams.
# Whether to include presence data in the output. Defaults to false. Setting this to true reduces performance, especially with large teams.
# @see https://api.slack.com/methods/users.list
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.list.json
def users_list(options = {})
Expand All @@ -74,6 +74,18 @@ def users_list(options = {})
end
end

#
# Find a user with an email address.
#
# @option options [Object] :email
# An email address belonging to a user in the workspace.
# @see https://api.slack.com/methods/users.lookupByEmail
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.lookupByEmail.json
def users_lookupByEmail(options = {})
throw ArgumentError.new('Required arguments :email missing') if options[:email].nil?
post('users.lookupByEmail', options)
end

#
# Marks a user as active.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/slack/web/api/slack-api-ref
Submodule slack-api-ref updated 143 files