22
33var https = require ( 'https' ) ;
44var fs = require ( 'fs' ) ;
5+ var pkg = require ( './package.json' ) ;
6+
7+ var API_VERSION = 4 ;
58
69// http://underscorejs.org/docs/underscore.html#section-118
710function isObject ( obj ) {
@@ -59,8 +62,8 @@ module.exports = function(api_key) {
5962 method : method ,
6063 headers : {
6164 'Authorization' : auth ,
62- 'Accept' : 'application/vnd.blockscore+json;version=4' ,
63- 'User-Agent' : 'blockscore-node/4.0.0 (https://github.com/BlockScore/blockscore-node)' ,
65+ 'Accept' : 'application/vnd.blockscore+json;version=' + API_VERSION ,
66+ 'User-Agent' : 'blockscore-node/' + pkg . version + ' (https://github.com/BlockScore/blockscore-node)',
6467 'Content-Type' : 'application/json' ,
6568 'Content-Length' : request_data . length
6669 } ,
@@ -130,7 +133,7 @@ module.exports = function(api_key) {
130133 if ( person_id && typeof person_id === 'string' ) {
131134 data = { person_id : person_id } ;
132135 } else if ( person_id && isObject ( person_id ) && 'person_id' in person_id ) {
133- data = person_id ;
136+ data = person_id ;
134137 } else {
135138 return cb ( new Error ( "person_id required" ) ) ;
136139 }
@@ -155,7 +158,7 @@ module.exports = function(api_key) {
155158 } ,
156159 del : function ( candidate_id , cb ) {
157160 del ( '/candidates/' + encodeURIComponent ( candidate_id ) , { } , cb ) ;
158- } ,
161+ } ,
159162 retrieve : function ( candidate_id , cb ) {
160163 if ( ! ( candidate_id && typeof candidate_id === 'string' ) ) {
161164 return cb ( new Error ( "candidate_id required" ) ) ;
0 commit comments