Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Port functionality of Hooks from Repo's to Orgs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Potter committed Mar 12, 2016
1 parent 93944cb commit c4394a5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/octonode/org.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,26 @@ class Org
return cb(err) if err
if s isnt 204 then cb(new Error('Org addTeamRepo error')) else cb null, b, h

# List hooks
# '/orgs/pksunkara/hub/hooks' GET
hooks: (cb) ->
@client.get "/orgs/#{@name}/hooks", (err, s, b, h) ->
return cb(err) if (err)
if s isnt 200 then cb(new Error("Repo hooks error")) else cb null, b, h

# Create a hook
# '/orgs/pksunkara/hub/hooks' POST
hook: (hookInfo, cb) ->
@client.post "/orgs/#{@name}/hooks", hookInfo, (err, s, b, h) ->
return cb(err) if err
if s isnt 201 then cb(new Error("Repo createHook error")) else cb null, b, h

# Delete a hook
# '/orgs/pksunkara/hub/hooks/37' DELETE
deleteHook: (id, cb) ->
@client.del "/orgs/#{@name}/hooks/#{id}", {}, (err, s, b, h) ->
return cb(err) if err
if s isnt 204 then cb(new Error("Repo deleteHook error")) else cb null, b, h

# Export module
module.exports = Org

0 comments on commit c4394a5

Please sign in to comment.