Created
April 1, 2015 18:13
-
-
Save jdcauley/b18ae5f48ce0010eb433 to your computer and use it in GitHub Desktop.
Gulp for API Testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} | |
}); | |
} | |
}); | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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