Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Commit

Permalink
Merge pull request #5 from samdbeckham/dnd-endpoint
Browse files Browse the repository at this point in the history
Added the DND section of the Slack API
  • Loading branch information
germanrcuriel committed Feb 12, 2016
2 parents 7397da3 + fd9dff0 commit 92ada59
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/api/dnd.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
BaseClass = require './common/base_class'

class Dnd extends BaseClass

endpoints:
endDnd: '/api/dnd.endDnd'
endSnooze: '/api/dnd.endSnooze'
info: '/api/dnd.info'
setSnooze: '/api/dnd.setSnooze'
teamInfo: '/api/dnd.teamInfo'

#
# Official API Methods
#
endDnd: (opts = {}, callback) ->
@request 'POST', @endpoints.endDnd, opts, callback

endSnooze: (opts = {}, callback) ->
@request 'POST', @endpoints.endSnooze, opts, callback

info: (opts = {}, callback) ->
@request 'POST', @endpoints.info, opts, callback

setSnooze: (opts = {}, callback) ->
@validate.obj opts, [ 'num_minutes' ]
@request 'POST', @endpoints.setSnooze, opts, callback

teamInfo: (opts = {}, callback) ->
@request 'POST', @endpoints.teamInfo, opts, callback

module.exports = Dnd
1 change: 1 addition & 0 deletions src/slack.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Slack
'auth': require './api/auth'
'channels': require './api/channels'
'chat': require './api/chat'
'dnd': require './api/dnd'
'emoji': require './api/emoji'
'groups': require './api/groups'
'im': require './api/im'
Expand Down
3 changes: 3 additions & 0 deletions test/slack.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ describe 'Slack', ->
it 'adds chat to the api object', ->
@slack.api.should.have.property 'chat'

it 'adds dnd to the api object', ->
@slack.api.should.have.property 'dnd'

it 'adds emoji to the api object', ->
@slack.api.should.have.property 'emoji'

Expand Down

0 comments on commit 92ada59

Please sign in to comment.