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
This method helps answer questions like: - Which conversations am I a member of? - Which public channels is my bot user in? - Do I have any direct messages open with my friend Suzy? - Is my bot a member of any private channels?.
-
#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
This method helps answer questions like:
-
Which conversations am I a member of?
-
Which public channels is my bot user in?
-
Do I have any direct messages open with my friend Suzy?
-
Is my bot a member of any private channels?
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/slack/web/api/endpoints/users.rb', line 27 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.
43 44 45 |
# File 'lib/slack/web/api/endpoints/users.rb', line 43 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.
55 56 57 58 59 |
# File 'lib/slack/web/api/endpoints/users.rb', line 55 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.
66 67 68 |
# File 'lib/slack/web/api/endpoints/users.rb', line 66 def users_identity( = {}) post('users.identity', ) end |
#users_info(options = {}) ⇒ Object
This method returns information about a member of a workspace.
79 80 81 82 83 |
# File 'lib/slack/web/api/endpoints/users.rb', line 79 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.
96 97 98 99 100 101 102 103 104 |
# File 'lib/slack/web/api/endpoints/users.rb', line 96 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.
113 114 115 116 |
# File 'lib/slack/web/api/endpoints/users.rb', line 113 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.
123 124 125 |
# File 'lib/slack/web/api/endpoints/users.rb', line 123 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.
140 141 142 143 |
# File 'lib/slack/web/api/endpoints/users.rb', line 140 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.
153 154 155 156 |
# File 'lib/slack/web/api/endpoints/users.rb', line 153 def users_setPresence( = {}) throw ArgumentError.new('Required arguments :presence missing') if [:presence].nil? post('users.setPresence', ) end |