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

Delete the user profile photo



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

Gets user presence information.

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:



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

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

Get a user’s identity.



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

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

#users_info(options = {}) ⇒ Object

Gets information about a user.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :user (user)

    User to get info on.

See Also:



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

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

Lists all users in a Slack team.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :cursor (Object)

    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.

  • :limit (Object)

    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.

  • :presence (Object)

    Whether to include presence data in the output. Setting this to false improves performance, especially with large teams.

See Also:



63
64
65
# File 'lib/slack/web/api/endpoints/users.rb', line 63

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

#users_setActive(options = {}) ⇒ Object

Marks a user as active.



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

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

#users_setPhoto(options = {}) ⇒ Object

Set the user profile photo

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :image (Object)

    File contents via multipart/form-data.

  • :crop_w (Object)

    Width/height of crop box (always square).

  • :crop_x (Object)

    X coordinate of top-left corner of crop box.

  • :crop_y (Object)

    Y coordinate of top-left corner of crop box.

See Also:



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

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

#users_setPresence(options = {}) ⇒ Object

Manually sets user presence.

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