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

Instance Method Details

#users_deletePhoto(options = {}) ⇒ Object

This method allows the user to delete their profile image. It will clear whatever image is currently set.



13
14
15
# File 'lib/slack/web/api/endpoints/users.rb', line 13

def users_deletePhoto(options = {})
  post('users.deletePhoto', options)
end

#users_getPresence(options = {}) ⇒ Object

This method lets you find out information about a user’s presence. Consult the presence documentation for more details.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :user (user)

    User to get presence info on. Defaults to the authed user.

See Also:



25
26
27
28
29
# File 'lib/slack/web/api/endpoints/users.rb', line 25

def users_getPresence(options = {})
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
  post('users.getPresence', options)
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.



36
37
38
# File 'lib/slack/web/api/endpoints/users.rb', line 36

def users_identity(options = {})
  post('users.identity', options)
end

#users_info(options = {}) ⇒ Object

This method returns information about a team member.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :user (user)

    User to get info on.

See Also:



47
48
49
50
51
# File 'lib/slack/web/api/endpoints/users.rb', line 47

def users_info(options = {})
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
  post('users.info', options)
end

#users_list(options = {}) ⇒ Object

This method returns a list of all users in the team. This includes deleted/deactivated users.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :presence (Object)

    Whether to include presence data in the output.

See Also:



60
61
62
# File 'lib/slack/web/api/endpoints/users.rb', line 60

def users_list(options = {})
  post('users.list', options)
end

#users_setActive(options = {}) ⇒ Object

This method lets the slack messaging server know that the authenticated user is currently active. Consult the presence documentation for more details.



71
72
73
# File 'lib/slack/web/api/endpoints/users.rb', line 71

def users_setActive(options = {})
  post('users.setActive', options)
end

#users_setPhoto(options = {}) ⇒ Object

This method allows the user to set their profile image. The caller can pass image data via image.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :image (Object)

    File contents via multipart/form-data.

  • :crop_x (Object)

    X coordinate of top-left corner of crop box.

  • :crop_y (Object)

    Y coordinate of top-left corner of crop box.

  • :crop_w (Object)

    Width/height of crop box (always square).

See Also:



88
89
90
91
# File 'lib/slack/web/api/endpoints/users.rb', line 88

def users_setPhoto(options = {})
  throw ArgumentError.new('Required arguments :image missing') if options[:image].nil?
  post('users.setPhoto', options)
end

#users_setPresence(options = {}) ⇒ Object

This method lets you set the calling user’s manual presence. Consult the presence documentation for more details.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :presence (Object)

    Either auto or away.

See Also:



101
102
103
104
# File 'lib/slack/web/api/endpoints/users.rb', line 101

def users_setPresence(options = {})
  throw ArgumentError.new('Required arguments :presence missing') if options[:presence].nil?
  post('users.setPresence', options)
end