Comparing version 0.0.3 to 0.0.4
@@ -7,2 +7,13 @@ var Request = require('./request').Request; | ||
Clips.prototype.search = function(opts, fn) { | ||
var paramsArr = []; | ||
for(var key in opts) { | ||
if(opts.hasOwnProperty(key)) { | ||
paramsArr.push(key + '=' + opts[key]); | ||
} | ||
} | ||
var path = 'search/clips/?' + paramsArr.join('&'); | ||
this.request.get(path, opts, fn); | ||
}; | ||
Clips.prototype.all = function(fn) { | ||
@@ -9,0 +20,0 @@ this.request.get('clips/', fn); |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"homepage": "", | ||
@@ -11,0 +11,0 @@ "repository": "git://github.com/enotionz/node-kippt.git", |
@@ -66,2 +66,10 @@ # node-kippt | ||
}); | ||
// search clips | ||
kippt.clips.search({ | ||
q: 'search_query', | ||
is_starred: Boolean | ||
}, function(error, data) { | ||
if(!error) console.log(data); | ||
}); | ||
``` | ||
@@ -68,0 +76,0 @@ |
@@ -9,2 +9,16 @@ var mocha = require('mocha'); | ||
describe('#search()', function() { | ||
it('should return information about the query', function(done) { | ||
clips.search({ | ||
q: 'javascript', | ||
is_starred: false | ||
},function(err, data) { | ||
assert.ok(!err, 'No error'); | ||
assert.ok(data, 'Has data'); | ||
assert.ok(data.objects, 'Has clips array'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('#all()', function() { | ||
@@ -11,0 +25,0 @@ it('should return JSON of full clips data', function(done) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12111
12
271
110