Comparing version 0.0.2 to 0.0.3
@@ -19,3 +19,3 @@ 'use strict'; | ||
.then(function(res) { | ||
return res.body | ||
return res.body; | ||
}); | ||
@@ -32,3 +32,3 @@ }; | ||
.then(function(res) { | ||
return res.body | ||
return res.body; | ||
}); | ||
@@ -44,3 +44,3 @@ }; | ||
.then(function(res) { | ||
return res.body | ||
return res.body; | ||
}); | ||
@@ -57,6 +57,21 @@ }; | ||
.then(function(res) { | ||
return res.body | ||
return res.body; | ||
}); | ||
}; | ||
var top = function(category) { | ||
var uri = endpoint + 'torrents/top/'; | ||
category = category || 'all'; | ||
return client | ||
.get(uri) | ||
.query({ category: category }) | ||
.end() | ||
.then(function(res) { | ||
return res.body; | ||
}); | ||
}; | ||
module.exports = { | ||
@@ -66,3 +81,4 @@ info: info, | ||
countTotal: countTotal, | ||
search: search | ||
search: search, | ||
top: top | ||
}; |
{ | ||
"name": "strike-api", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Strike Search API client", | ||
@@ -24,2 +24,5 @@ "main": "lib/strike.js", | ||
"devDependencies": { | ||
"gulp": "^3.8.11", | ||
"gulp-eslint": "^0.7.0", | ||
"gulp-mocha": "^2.0.0", | ||
"mocha": "^2.2.1" | ||
@@ -26,0 +29,0 @@ }, |
@@ -1,2 +0,4 @@ | ||
var assert = require("assert"); | ||
'use strict'; | ||
var assert = require('assert'); | ||
var strike = require('../lib/strike'); | ||
@@ -21,3 +23,3 @@ | ||
}); | ||
}) | ||
}); | ||
}); | ||
@@ -36,3 +38,3 @@ | ||
}); | ||
}) | ||
}); | ||
}); | ||
@@ -57,3 +59,3 @@ | ||
}); | ||
}) | ||
}); | ||
}); | ||
@@ -72,4 +74,23 @@ | ||
}); | ||
}) | ||
}) | ||
}); | ||
}); | ||
describe('#top()', function(){ | ||
it('should return top for given category', function(done) { | ||
strike.top('Anime').then(function(result) { | ||
var status = result[0]; | ||
var data = result[1]; | ||
assert.equal(200, status.statuscode); | ||
assert.ok(data.length > 0); | ||
assert.equal('Anime', data[0].torrent_category); | ||
done(); | ||
}).catch(function(err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
}); | ||
Sorry, the diff of this file is not supported yet
7679
8
168
4