fulcrum-app
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -1,5 +0,7 @@ | ||
var Base, Records, mixins, | ||
var Base, Records, async, mixins, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
async = require('async'); | ||
mixins = require('./mixins/'); | ||
@@ -28,2 +30,30 @@ | ||
Records.prototype.history = function(id, cb) { | ||
var do_get, do_process_http_errors, tasks; | ||
do_get = (function(_this) { | ||
return function(callback) { | ||
return _this.request('get', _this.url(id) + '/history', null, function(error, response, body) { | ||
if (error) { | ||
return callback(error); | ||
} else { | ||
return callback(null, response, body); | ||
} | ||
}); | ||
}; | ||
})(this); | ||
do_process_http_errors = (function(_this) { | ||
return function(response, body, callback) { | ||
return _this.process_http_errors(response, function(error) { | ||
if (error) { | ||
return callback(error); | ||
} else { | ||
return callback(null, body); | ||
} | ||
}); | ||
}; | ||
})(this); | ||
tasks = [do_get, do_process_http_errors]; | ||
return async.waterfall(tasks, cb); | ||
}; | ||
return Records; | ||
@@ -30,0 +60,0 @@ |
{ | ||
"name": "fulcrum-app", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "JavaScript wrapper for the Fulcrum API", | ||
@@ -16,2 +16,5 @@ "main": "lib/index.js", | ||
], | ||
"browser": { | ||
"request": "xhr" | ||
}, | ||
"author": "Jason Sanford", | ||
@@ -25,8 +28,10 @@ "license": "MIT", | ||
"gulp-mocha": "~0.5.0", | ||
"nock": "~0.42.1" | ||
"nock": "~0.42.1", | ||
"coffeeify": "~0.6.0" | ||
}, | ||
"dependencies": { | ||
"request": "~2.37.0", | ||
"async": "~0.9.0" | ||
"async": "~0.9.0", | ||
"xhr": "1.13.0" | ||
} | ||
} |
@@ -24,2 +24,15 @@ var assert = require('assert'); | ||
describe('#history()', function(){ | ||
it('should return records.', function(done){ | ||
var nocker = nock('https://api.fulcrumapp.com') | ||
.get('/api/v2/records/916474a7-b995-4b36-81db-8eda97f93a73/history') | ||
.replyWithFile(200, __dirname + '/objects/record_history.json'); | ||
client.records.history('916474a7-b995-4b36-81db-8eda97f93a73', function(error, history) { | ||
assert.ifError(error); | ||
assert(history.records instanceof Array, 'records is not an array.'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('#delete()', function(){ | ||
@@ -26,0 +39,0 @@ it('should not return an error if deleted.', function(done){ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
147340
65
3800
262
3
7
11
+ Addedxhr@1.13.0
+ Addeddeep-equal@0.0.0(transitive)
+ Addeddefined@0.0.0(transitive)
+ Addedglobal@2.0.7(transitive)
+ Addedjsonify@0.0.1(transitive)
+ Addedmin-document@0.2.8(transitive)
+ Addedonce@1.1.1(transitive)
+ Addedprocess@0.5.2(transitive)
+ Addedtape@1.0.4(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedxhr@1.13.0(transitive)