-
Notifications
You must be signed in to change notification settings - Fork 2
/
Sprint.js
35 lines (26 loc) · 862 Bytes
/
Sprint.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var https = require('https')
var auth = require('./auth.json')
var rsvp = require('rsvp')
function Sprint(boardId, sprintId) {
this.boardId = boardId
this.sprintId = sprintId
}
Sprint.prototype.getSprint = function() {
var url = "https://"+auth.username+":"+auth.password+"@epages.atlassian.net/rest/greenhopper/latest/rapid/charts/sprintreport?rapidViewId="+this.boardId+"&sprintId="+this.sprintId
var promise = new rsvp.Promise(function(resolve) {
https.get(url, function(res) {
var body = ''
res.on('data', function(data) {
body += data
})
res.on('end', function() {
var sprint = JSON.parse(body)
resolve(sprint)
})
}).on('error', function(e) {
console.log("Got error: " + e.message)
})
})
return promise
}
module.exports = Sprint