Skip to content

Instantly share code, notes, and snippets.

@jdcauley
Created April 1, 2015 18:13
Show Gist options
  • Save jdcauley/b18ae5f48ce0010eb433 to your computer and use it in GitHub Desktop.
Save jdcauley/b18ae5f48ce0010eb433 to your computer and use it in GitHub Desktop.
Gulp for API Testing
var gulp = require('gulp');
var jsforce = require('jsforce');
var async = require('async');
gulp.task('force', function(){
var conn = new jsforce.Connection();
conn.login('<Salesforce Login Email>', '<Salesforce Password + Security Token>', function(err, userInfo) {
if (err) console.error(err);
if(userInfo){
console.log("User ID: " + userInfo.id);
conn.sobject('Contact').find().execute(function(err, res){
if(err) console.log(err);
if(res){
async.each(res, function(contact, asyncCB){
console.log(contact);
asyncCB();
}, function(err){
if(err){
console.log(err);
} else {
console.log('done');
}
});
}
});
}
});
});
{
"name": "gulp-force",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"async": "^0.9.0",
"jsforce": "^1.3.1"
},
"devDependencies": {
"gulp": "^3.8.11"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment