Module: Slack::Web::Api::Endpoints::Users
- Included in:
- Slack::Web::Api::Endpoints
- Defined in:
- lib/slack/web/api/endpoints/users.rb
Instance Method Summary collapse
-
#users_conversations(options = {}) ⇒ Object
As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with.
-
#users_deletePhoto(options = {}) ⇒ Object
This method allows the user to delete their profile image.
-
#users_getPresence(options = {}) ⇒ Object
This method lets you find out information about a user’s presence.
-
#users_identity(options = {}) ⇒ Object
After your Slack app is awarded an identity token through Sign in with Slack, use this method to retrieve a user’s identity.
-
#users_info(options = {}) ⇒ Object
This method returns information about a member of a workspace.
-
#users_list(options = {}) ⇒ Object
This method returns a list of all users in the workspace.
-
#users_lookupByEmail(options = {}) ⇒ Object
Retrieve a single user by looking them up by their registered email address.
-
#users_setActive(options = {}) ⇒ Object
This method is no longer functional and the behavior it controlled is no longer offered.
-
#users_setPhoto(options = {}) ⇒ Object
This method allows the user to set their profile image.
-
#users_setPresence(options = {}) ⇒ Object
This method lets you set the calling user’s manual presence.
Instance Method Details
#users_conversations(options = {}) ⇒ Object
As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/slack/web/api/endpoints/users.rb', line 23 def users_conversations( = {}) = .merge(user: users_id()['user']['id']) if [:user] if block_given? Pagination::Cursor.new(self, :users_conversations, ).each do |page| yield page end else post('users.conversations', ) end end |
#users_deletePhoto(options = {}) ⇒ Object
This method allows the user to delete their profile image. It will clear whatever image is currently set.
39 40 41 |
# File 'lib/slack/web/api/endpoints/users.rb', line 39 def users_deletePhoto( = {}) post('users.deletePhoto', ) end |
#users_getPresence(options = {}) ⇒ Object
This method lets you find out information about a user’s presence. Consult the presence documentation for more details.
51 52 53 54 55 |
# File 'lib/slack/web/api/endpoints/users.rb', line 51 def users_getPresence( = {}) throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(user: users_id()['user']['id']) if [:user] post('users.getPresence', ) end |
#users_identity(options = {}) ⇒ Object
After your Slack app is awarded an identity token through Sign in with Slack, use this method to retrieve a user’s identity.
62 63 64 |
# File 'lib/slack/web/api/endpoints/users.rb', line 62 def users_identity( = {}) post('users.identity', ) end |
#users_info(options = {}) ⇒ Object
This method returns information about a member of a workspace.
75 76 77 78 79 |
# File 'lib/slack/web/api/endpoints/users.rb', line 75 def users_info( = {}) throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(user: users_id()['user']['id']) if [:user] post('users.info', ) end |
#users_list(options = {}) ⇒ Object
This method returns a list of all users in the workspace. This includes deleted/deactivated users.
92 93 94 95 96 97 98 99 100 |
# File 'lib/slack/web/api/endpoints/users.rb', line 92 def users_list( = {}) if block_given? Pagination::Cursor.new(self, :users_list, ).each do |page| yield page end else post('users.list', ) end end |
#users_lookupByEmail(options = {}) ⇒ Object
Retrieve a single user by looking them up by their registered email address. Requires users:read.email.
109 110 111 112 |
# File 'lib/slack/web/api/endpoints/users.rb', line 109 def users_lookupByEmail( = {}) throw ArgumentError.new('Required arguments :email missing') if [:email].nil? post('users.lookupByEmail', ) end |
#users_setActive(options = {}) ⇒ Object
This method is no longer functional and the behavior it controlled is no longer offered. The method will no longer exist beginning May 8, 2018.
119 120 121 |
# File 'lib/slack/web/api/endpoints/users.rb', line 119 def users_setActive( = {}) post('users.setActive', ) end |
#users_setPhoto(options = {}) ⇒ Object
This method allows the user to set their profile image. The caller can pass image data via image.
136 137 138 139 |
# File 'lib/slack/web/api/endpoints/users.rb', line 136 def users_setPhoto( = {}) throw ArgumentError.new('Required arguments :image missing') if [:image].nil? post('users.setPhoto', ) end |
#users_setPresence(options = {}) ⇒ Object
This method lets you set the calling user’s manual presence. Consult the presence documentation for more details.
149 150 151 152 |
# File 'lib/slack/web/api/endpoints/users.rb', line 149 def users_setPresence( = {}) throw ArgumentError.new('Required arguments :presence missing') if [:presence].nil? post('users.setPresence', ) end |