Module: Slack::Web::Api::Endpoints::Dnd

Included in:
Slack::Web::Api::Endpoints
Defined in:
lib/slack/web/api/endpoints/dnd.rb

Instance Method Summary collapse

Instance Method Details

#dnd_endDnd(options = {}) ⇒ Object

Ends the current user’s Do Not Disturb session immediately.



14
15
16
# File 'lib/slack/web/api/endpoints/dnd.rb', line 14

def dnd_endDnd(options = {})
  post('dnd.endDnd', options)
end

#dnd_endSnooze(options = {}) ⇒ Object

Ends the current user’s snooze mode immediately.



23
24
25
# File 'lib/slack/web/api/endpoints/dnd.rb', line 23

def dnd_endSnooze(options = {})
  post('dnd.endSnooze', options)
end

#dnd_info(options = {}) ⇒ Object

Retrieves a user’s current Do Not Disturb status.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :team_id (string)

    Encoded team id where passed in user param belongs, required if org token is used. If no user param is passed, then a team which has access to the app should be passed.

  • :user (user)

    User to fetch status for (defaults to current user).

See Also:



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

def dnd_info(options = {})
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
  post('dnd.info', options)
end

#dnd_setSnooze(options = {}) ⇒ Object

Turns on Do Not Disturb mode for the current user, or changes its duration.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :num_minutes (string)

    Number of minutes, from now, to snooze until.

See Also:



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

def dnd_setSnooze(options = {})
  post('dnd.setSnooze', options)
end

#dnd_teamInfo(options = {}) ⇒ Object

Retrieves the Do Not Disturb status for up to 50 users on a team.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :users (string)

    Comma-separated list of users to fetch Do Not Disturb status for.

  • :team_id (string)

    Encoded team id where passed in users belong, required if org token is used.

See Also:



61
62
63
64
# File 'lib/slack/web/api/endpoints/dnd.rb', line 61

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