ma3route-sdk
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -9,2 +9,12 @@ # Change Log | ||
## 2.2.0 - 2022-05-29 | ||
Added: | ||
* Added methods: | ||
* `drivingReports.getTags()`: Fetch tags for driving reports. | ||
* `trafficUpdates.getTags()`: Fetch tags for traffic updates. | ||
## 2.1.0 - 2021-06-20 | ||
@@ -11,0 +21,0 @@ |
@@ -53,2 +53,11 @@ /** | ||
), | ||
/** | ||
* Retrieve tags for driving reports | ||
* @type {itemsGetRequest} | ||
*/ | ||
getTags: generate.newGet("drivingreports/tags", { | ||
allowable: ["timeFilter"], | ||
apiVersion: 3, | ||
camelcase: false, | ||
}), | ||
}; |
@@ -32,6 +32,17 @@ /** | ||
* @param {Endpoint} endpoint | ||
* @param {String[]} [allowable] | ||
* @param {Object} [options] | ||
* @param {String[]} [options.allowable] | ||
* @param {Number} [options.apiVersion=2] API version used | ||
* @param {Boolean} [options.camelcase=true] | ||
* @return {itemsGetRequest} | ||
*/ | ||
function newGet(endpoint, allowable) { | ||
function newGet(endpoint, options) { | ||
// for backwards-compatibility <= 2.1.0 | ||
if (_.isArray(options)) { | ||
options = { allowable: options }; | ||
} | ||
options = _.defaultsDeep({}, options, { | ||
allowable: [], | ||
}); | ||
return function(params, callback) { | ||
@@ -43,2 +54,3 @@ // allow options params | ||
utils.setup(), | ||
options, | ||
this, | ||
@@ -58,3 +70,7 @@ args.params, | ||
// remove params that are not allowed | ||
args.params = utils.pickParams(args.params, allowable); | ||
args.params = utils.pickParams( | ||
args.params, | ||
options.allowable, | ||
options.camelcase | ||
); | ||
// add the params as querystring to the URI | ||
@@ -64,3 +80,5 @@ utils.addQueries(uri, args.params); | ||
try { | ||
auth.sign(authOptions.key, authOptions.secret, uri); | ||
auth.sign(authOptions.key, authOptions.secret, uri, undefined, { | ||
apiVersion: uriOptions.apiVersion, | ||
}); | ||
} catch (err) { | ||
@@ -67,0 +85,0 @@ return args.callback(err); |
@@ -53,2 +53,11 @@ /** | ||
getSeverityLevels: generate.newGet("severity", []), | ||
/** | ||
* Retrieve tags for traffic updates | ||
* @type {itemsGetRequest} | ||
*/ | ||
getTags: generate.newGet("trafficupdates/tags", { | ||
allowable: ["timeFilter", "townId"], | ||
apiVersion: 3, | ||
camelcase: false, | ||
}), | ||
}; |
@@ -499,3 +499,4 @@ /** | ||
*/ | ||
function pickParams(params, keys) { | ||
function pickParams(params, keys, camelcase) { | ||
camelcase = camelcase === undefined ? true : camelcase; | ||
params = _.cloneDeep(params); | ||
@@ -508,3 +509,3 @@ // decamelize all options | ||
// 'base64String': introduced by 'image.upload()' | ||
if (["base64String"].indexOf(key) === -1) { | ||
if (["base64String"].indexOf(key) === -1 && camelcase) { | ||
key = decamelize(key, "_"); | ||
@@ -511,0 +512,0 @@ } |
{ | ||
"name": "ma3route-sdk", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Node.js SDK for developing with the Ma3Route REST API", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
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
61496
26
1735