Skip to content

Commit 72109d8

Browse files
committed
Merge pull request #39 from rosette-api/RCB_389_Release_1_1
Release 1.1. Includes code cleanup
2 parents 6b0104f + 1e22cef commit 72109d8

20 files changed

+1265
-1314
lines changed

lib/Api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var checkVersion = require("./checkVersion");
3636
*
3737
* @type string
3838
*/
39-
var BINDING_VERSION = "1.0";
39+
var BINDING_VERSION = "1.1";
4040

4141
/**
4242
* @class
@@ -95,7 +95,7 @@ Api.prototype.rosette = function(endpoint, callback) {
9595
var c = new checkVersion();
9696

9797
// check if server and client API versions match
98-
c.check(this.userKey, this.serviceURL, function(err, res) {
98+
c.check(api.parameters, this.userKey, this.serviceURL, function(err, res) {
9999
if (err) {
100100
return callback(err);
101101
} else if (!res.versionChecked) {

lib/categories.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
**/
1414
"use strict";
1515

16-
var http = require("http");
17-
var https = require("https");
1816
var URL = require("url");
19-
var zlib = require("zlib");
2017

2118
var RosetteConstants = require("./rosetteConstants");
2219
var RosetteException = require("./rosetteExceptions");

lib/checkVersion.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
**/
1414
"use strict";
1515

16-
var http = require("http");
17-
var https = require("https");
1816
var URL = require("url");
19-
var zlib = require("zlib");
2017

2118
var rosetteConstants = require("./rosetteConstants");
2219
var RosetteException = require("./rosetteExceptions");
@@ -38,12 +35,12 @@ function checkVersion() {
3835
* @param {string} serviceURL - The base service URL to be used to access the Rosette API
3936
* @param {function} callback - Callback function to be exectuted after the function to which it is passed is complete
4037
*/
41-
checkVersion.prototype.check = function(userKey, serviceURL, callback) {
38+
checkVersion.prototype.check = function(parameters, userKey, serviceURL, callback) {
4239
var req = new rosetteRequest();
4340
// configure URL
4441
var urlParts = URL.parse(serviceURL + "info?clientVersion=" + req.bindingVersion());
4542

46-
req.makeRequest('POST', userKey, urlParts, null, callback);
43+
req.makeRequest('POST', userKey, urlParts, parameters, callback);
4744

4845
};
4946

lib/entities.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
**/
1414
"use strict";
1515

16-
var http = require("http");
17-
var https = require("https");
1816
var URL = require("url");
19-
var zlib = require("zlib");
2017

2118
var rosetteConstants = require("./rosetteConstants");
2219
var RosetteException = require("./rosetteExceptions");
@@ -43,10 +40,10 @@ entities.prototype.getResults = function(parameters, userKey, serviceURL, callba
4340

4441
if (parameters.loadParams().documentFile != null) {
4542
if (parameters.loadParams().linked == true) {
46-
parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, serviceURL, "entities/linked", callback);
47-
} else {
48-
parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, serviceURL, "entities", callback);
49-
}
43+
parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, serviceURL, "entities/linked", callback);
44+
} else {
45+
parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, serviceURL, "entities", callback);
46+
}
5047

5148
} else {
5249

lib/info.js

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,47 @@
1-
/**
2-
* Rosette API.
3-
*
4-
* @copyright 2014-2015 Basis Technology Corporation.
5-
*
6-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
7-
* with the License. You may obtain a copy of the License at
8-
* @license http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software distributed under the License is
11-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
* See the License for the specific language governing permissions and limitations under the License.
13-
**/
14-
"use strict";
15-
16-
var http = require("http");
17-
var https = require("https");
18-
var URL = require("url");
19-
var zlib = require("zlib");
20-
21-
var rosetteConstants = require("./rosetteConstants");
22-
var RosetteException = require("./rosetteExceptions");
23-
var rosetteRequest = require("./rosetteRequest");
24-
25-
/**
26-
* @class
27-
*
28-
* @copyright 2014-2015 Basis Technology Corporation.
29-
* @license http://www.apache.org/licenses/LICENSE-2.0
30-
*/
31-
function info() {
32-
33-
};
34-
35-
/**
36-
* Makes an HTTP request to the specified Rosette API endpoint and returns the result
37-
* @param {string} parameters - The Rosette API endpoint parameters
38-
* @param {string} userKey - The Rosette API user access key
39-
* @param {string} serviceURL - The base service URL to be used to access the Rosette API
40-
* @param {function} callback - Callback function to be exectuted after the function to which it is passed is complete
41-
*/
42-
info.prototype.getResults = function(parameters, userKey, serviceURL, callback) {
43-
44-
// configure URL
45-
var urlParts = URL.parse(serviceURL + "info");
46-
var req = new rosetteRequest();
47-
req.makeRequest('GET', userKey, urlParts, null, callback);
48-
};
49-
50-
module.exports = info;
1+
/**
2+
* Rosette API.
3+
*
4+
* @copyright 2014-2015 Basis Technology Corporation.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
7+
* with the License. You may obtain a copy of the License at
8+
* @license http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License is
11+
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and limitations under the License.
13+
**/
14+
"use strict";
15+
16+
var URL = require("url");
17+
18+
var rosetteConstants = require("./rosetteConstants");
19+
var RosetteException = require("./rosetteExceptions");
20+
var rosetteRequest = require("./rosetteRequest");
21+
22+
/**
23+
* @class
24+
*
25+
* @copyright 2014-2015 Basis Technology Corporation.
26+
* @license http://www.apache.org/licenses/LICENSE-2.0
27+
*/
28+
function info() {
29+
30+
};
31+
32+
/**
33+
* Makes an HTTP request to the specified Rosette API endpoint and returns the result
34+
* @param {string} parameters - The Rosette API endpoint parameters
35+
* @param {string} userKey - The Rosette API user access key
36+
* @param {string} serviceURL - The base service URL to be used to access the Rosette API
37+
* @param {function} callback - Callback function to be exectuted after the function to which it is passed is complete
38+
*/
39+
info.prototype.getResults = function(parameters, userKey, serviceURL, callback) {
40+
41+
// configure URL
42+
var urlParts = URL.parse(serviceURL + "info");
43+
var req = new rosetteRequest();
44+
req.makeRequest('GET', userKey, urlParts, parameters, callback);
45+
};
46+
47+
module.exports = info;

lib/language.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
**/
1414
"use strict";
1515

16-
var http = require("http");
17-
var https = require("https");
1816
var URL = require("url");
19-
var zlib = require("zlib");
2017

2118
var rosetteConstants = require("./rosetteConstants");
2219
var RosetteException = require("./rosetteExceptions");

lib/morphology.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
**/
1414
"use strict";
1515

16-
var http = require("http");
17-
var https = require("https");
1816
var URL = require("url");
19-
var zlib = require("zlib");
2017

2118
var RosetteConstants = require("./rosetteConstants");
2219
var RosetteException = require("./rosetteExceptions");
@@ -55,7 +52,6 @@ morphology.prototype.getResults = function(parameters, userKey, serviceURL, call
5552
} else {
5653
// configure URL
5754
var urlParts = URL.parse(serviceURL + "morphology" + "/" + parameters.loadParams().morphology);
58-
var protocol = https;
5955
var req = new rosetteRequest();
6056
req.makeRequest('POST', userKey, urlParts, parameters, callback);
6157
}

lib/nameSimilarity.js

Lines changed: 58 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,58 @@
1-
/**
2-
* Rosette API.
3-
*
4-
* @copyright 2014-2015 Basis Technology Corporation.
5-
*
6-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
7-
* with the License. You may obtain a copy of the License at
8-
* @license http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software distributed under the License is
11-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
* See the License for the specific language governing permissions and limitations under the License.
13-
**/
14-
"use strict";
15-
16-
var http = require("http");
17-
var https = require("https");
18-
var URL = require("url");
19-
var zlib = require("zlib");
20-
21-
var rosetteConstants = require("./rosetteConstants");
22-
var RosetteException = require("./rosetteExceptions");
23-
var rosetteRequest = require("./rosetteRequest");
24-
25-
/**
26-
* @class
27-
*
28-
* @copyright 2014-2015 Basis Technology Corporation.
29-
* @license http://www.apache.org/licenses/LICENSE-2.0
30-
*/
31-
function nameSimilarity() {
32-
33-
};
34-
35-
/**
36-
* Makes an HTTP request to the specified Rosette API endpoint and returns the result
37-
* @param {string} parameters - The Rosette API endpoint parameters
38-
* @param {string} userKey - The Rosette API user access key
39-
* @param {string} serviceURL - The base service URL to be used to access the Rosette API
40-
* @param {function} callback - Callback function to be exectuted after the function to which it is passed is complete
41-
*/
42-
nameSimilarity.prototype.getResults = function(parameters, userKey, serviceURL, callback) {
43-
44-
if (parameters.loadParams().documentFile != null) {
45-
parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, serviceURL, "name-similarity", callback);
46-
} else {
47-
48-
// validate parameters
49-
if (parameters.loadParams().name1 == null || parameters.loadParams().name2 == null) {
50-
return callback( new RosetteException("badArgument", "Must supply both name1 and name2 parameters to be matched."));
51-
} else {
52-
// configure URL
53-
var urlParts = URL.parse(serviceURL + "name-similarity");
54-
var req = new rosetteRequest();
55-
req.makeRequest('POST', userKey, urlParts, parameters, callback);
56-
}
57-
}
58-
59-
};
60-
61-
module.exports = nameSimilarity;
1+
/**
2+
* Rosette API.
3+
*
4+
* @copyright 2014-2015 Basis Technology Corporation.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
7+
* with the License. You may obtain a copy of the License at
8+
* @license http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License is
11+
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and limitations under the License.
13+
**/
14+
"use strict";
15+
16+
var URL = require("url");
17+
18+
var rosetteConstants = require("./rosetteConstants");
19+
var RosetteException = require("./rosetteExceptions");
20+
var rosetteRequest = require("./rosetteRequest");
21+
22+
/**
23+
* @class
24+
*
25+
* @copyright 2014-2015 Basis Technology Corporation.
26+
* @license http://www.apache.org/licenses/LICENSE-2.0
27+
*/
28+
function nameSimilarity() {
29+
30+
};
31+
32+
/**
33+
* Makes an HTTP request to the specified Rosette API endpoint and returns the result
34+
* @param {string} parameters - The Rosette API endpoint parameters
35+
* @param {string} userKey - The Rosette API user access key
36+
* @param {string} serviceURL - The base service URL to be used to access the Rosette API
37+
* @param {function} callback - Callback function to be exectuted after the function to which it is passed is complete
38+
*/
39+
nameSimilarity.prototype.getResults = function(parameters, userKey, serviceURL, callback) {
40+
41+
if (parameters.loadParams().documentFile != null) {
42+
parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, serviceURL, "name-similarity", callback);
43+
} else {
44+
45+
// validate parameters
46+
if (parameters.loadParams().name1 == null || parameters.loadParams().name2 == null) {
47+
return callback(new RosetteException("badArgument", "Must supply both name1 and name2 parameters to be matched."));
48+
} else {
49+
// configure URL
50+
var urlParts = URL.parse(serviceURL + "name-similarity");
51+
var req = new rosetteRequest();
52+
req.makeRequest('POST', userKey, urlParts, parameters, callback);
53+
}
54+
}
55+
56+
};
57+
58+
module.exports = nameSimilarity;

lib/nameTranslation.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
**/
1414
"use strict";
1515

16-
var http = require("http");
17-
var https = require("https");
1816
var URL = require("url");
19-
var zlib = require("zlib");
2017

2118
var rosetteConstants = require("./rosetteConstants");
2219
var RosetteException = require("./rosetteExceptions");

0 commit comments

Comments
 (0)