jira-tamarasaurus
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -130,3 +130,3 @@ // # JavaScript JIRA API for node.js # | ||
// later, easier | ||
this.makeUri = function(pathname, altBase) { | ||
this.makeUri = function(pathname, altBase, customVersion) { | ||
var basePath = 'rest/api/'; | ||
@@ -137,2 +137,8 @@ if (altBase != null) { | ||
var apiv = this.apiVersion; | ||
if(typeof customVersion !== 'undefined'){ | ||
apiv = customVersion; | ||
} | ||
var uri = url.format({ | ||
@@ -143,3 +149,3 @@ protocol: this.protocol, | ||
port: this.port, | ||
pathname: basePath + this.apiVersion + pathname | ||
pathname: basePath + apiv + pathname | ||
}); | ||
@@ -279,2 +285,43 @@ return uri; | ||
this.getSprint = function(rapidView, callback) { | ||
// 'rest/greenhopper/1.0/xboard/work/allData/?rapidViewId=121' | ||
var options = { | ||
rejectUnauthorized: this.strictSSL, | ||
uri: decodeURIComponent(this.makeUri('/xboard/work/allData/?rapidViewId='+rapidView, 'rest/greenhopper/', '1.0')), | ||
method: 'GET', | ||
json: true | ||
}; | ||
console.log(options); | ||
this.request(options, function(error, response, body) { | ||
// console.log(error, response); | ||
if (error) { | ||
callback(error, null); | ||
return; | ||
} | ||
if (response.statusCode === 404) { | ||
callback('Invalid URL'); | ||
return; | ||
} | ||
if (response.statusCode !== 200) { | ||
callback(response.statusCode + ': Unable to connect to JIRA during rapidView search.'); | ||
return; | ||
} | ||
callback(null, body); | ||
// if (response.body !== null) { | ||
// return response.body; | ||
// } | ||
}); | ||
} | ||
// ## Find the Rapid View for a specified project ## | ||
@@ -296,2 +343,4 @@ // ### Takes ### | ||
*/ | ||
// Project name doesn't work here! | ||
this.findRapidView = function(projectName, callback) { | ||
@@ -301,3 +350,3 @@ | ||
rejectUnauthorized: this.strictSSL, | ||
uri: this.makeUri('/rapidviews/list', 'rest/greenhopper/'), | ||
uri: this.makeUri('/rapidviews/list', 'rest/greenhopper/', '1.0'), | ||
method: 'GET', | ||
@@ -307,2 +356,4 @@ json: true | ||
// console.log(options); | ||
this.request(options, function(error, response) { | ||
@@ -328,2 +379,3 @@ | ||
for (var i = 0; i < rapidViews.length; i++) { | ||
console.log(rapidViews[i], projectName.toLowerCase()); | ||
if(rapidViews[i].name.toLowerCase() === projectName.toLowerCase()) { | ||
@@ -355,2 +407,3 @@ callback(null, rapidViews[i]); | ||
*/ | ||
this.getLastSprintForRapidView = function(rapidViewId, callback) { | ||
@@ -365,2 +418,4 @@ | ||
this.request(options, function(error, response) { | ||
@@ -704,6 +759,7 @@ | ||
maxResults: optional.maxResults || 50, | ||
fields: optional.fields || ["summary", "status", "assignee", "description"] | ||
// fields: optional.fields || ["summary", "status", "assignee", "description"] | ||
} | ||
}; | ||
this.request(options, function(error, response, body) { | ||
@@ -746,7 +802,7 @@ | ||
this.getUsersIssues = function(username, params, open, callback) { | ||
var jql = "assignee = '" + username + "'" ; | ||
var jql = "assignee = '" + username + "'" + ' AND Sprint in openSprints()'; | ||
var openText = ' AND status in (Open, "In Progress", Reopened)' + ' ORDER BY '+params.order+' '+params.sort;; | ||
if (open) { jql += openText; } | ||
this.searchJira(jql, {maxResults:1000, fields: ["summary", "status", "issuetype", "assignee", "description", "created", "reporter", "priority"]}, callback); | ||
// + 'AND Sprint in openSprints()' | ||
this.searchJira(jql, {maxResults:1000, fields: ["summary", "status", "issuetype", "assignee", "description", "created", "reporter", "priority", "sprint"]}, callback); | ||
}; | ||
@@ -753,0 +809,0 @@ |
{ | ||
"name": "jira-tamarasaurus", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "Wrapper for the JIRA API", | ||
@@ -5,0 +5,0 @@ "author": "Steven Surowiec <steven.surowiec@gmail.com>", |
177112
1321