saucelabs
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -5,2 +5,3 @@ var https = require('https'); | ||
var util = require('util'); | ||
var crypto = require('crypto'); | ||
@@ -263,2 +264,40 @@ module.exports = Saucelabs; | ||
Saucelabs.prototype.createPublicLink = function(id, date, hour, callback){ | ||
var self = this; | ||
if(typeof datetime == 'function'){ | ||
callback = datetime; | ||
datetime = null; | ||
}else if(typeof hour == 'function'){ | ||
callback = hour; | ||
hour = null; | ||
} | ||
var url = 'https://saucelabs.com/jobs/' + id; | ||
if(self.username && self.password){ | ||
if(datetime instanceof Date){ | ||
//in format YYYY-MM-DD-HH or YYYY-MM-DD | ||
if(hour){ | ||
datetime.setHours(hour); | ||
} | ||
var datetime_date = datetime.getUTCDate(), | ||
datetime_month = datetime.getUTCMonth() + 1, | ||
datetime_year = datetime.getUTCFullYear(), | ||
datetime_hours = datetime.getUTCHours(); | ||
var datetime_string = [datetime_year, (datetime_month < 10 ? '0' + datetime_month : datetime_month), (datetime_date < 10 ? '0' + datetime_date : datetime_date) ].join('-'); | ||
} | ||
var hash = crypto.createHmac('md5', self.options.username + ':' + self.options.password + (datetime_string ? ':' + datetime_string : '')).update(id).digest('hex'); | ||
url += '?auth=' + hash; | ||
} | ||
if(typeof callback == 'function'){ | ||
callback(null, url); | ||
} | ||
} | ||
Saucelabs.prototype.getJobArtifacts = function(id, callback){ | ||
} | ||
Saucelabs.prototype.send = function(req_data, callback){ | ||
@@ -265,0 +304,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "A wrapper around Saucelabs REST API", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "https://github.com/holidayextras/node-saucelabs", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -13,6 +13,11 @@ # node-saucelabs -- Node wrapper around the Saucelabs REST API | ||
## Authors | ||
- Dan Jenkins ([danjenkins](https://github.com/danjenkins)) | ||
- Mathieu Sabourin ([OniOni](https://github.com/OniOni)) | ||
## Writting a script | ||
```javascript | ||
var sauce = require('./index'); | ||
var sauce = require('saucelabs'); | ||
@@ -166,2 +171,10 @@ var myAccount = new sauce({ | ||
</tr> | ||
<tr> | ||
<td> | ||
Make a public link to a private job, no need to login | ||
</td> | ||
<td>createPublicLink(job_id, date, hour, cb) -> cb(err, url)<br /> | ||
createPublicLink(job_id, date, cb) -> cb(err, url)<br /> | ||
createPublicLink(job_id, cb) -> cb(err, url)</td> | ||
</tr> | ||
</tbody> | ||
@@ -168,0 +181,0 @@ </table> |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
14869
305
185
1