mean-comscore-api
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "mean-comscore-api", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Loads ComScore reports from the ComScore API", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -35,3 +35,5 @@ # ComScore API | ||
startdate: 20141001, | ||
parameters: 'parameterName:parameterValue' | ||
parameters: { | ||
parameterName: parameterValue | ||
} | ||
}) |
@@ -25,3 +25,8 @@ 'use strict'; | ||
if (req.query.parameters) { | ||
options.parameters = req.query.parameters; | ||
parameters = req.query.parameters.split('|'); | ||
options.parameters = {}; | ||
for (var i in parameters) { | ||
var parameter = parameters[i].split(':'); | ||
options.parameters[parameter[0]] = parameter[1]; | ||
} | ||
} | ||
@@ -28,0 +33,0 @@ return options; |
@@ -12,8 +12,6 @@ 'use strict'; | ||
var url = 'parameters='; | ||
parameters = parameters.split('|'); | ||
var encodedParameters = []; | ||
for (var i in parameters) { | ||
var parameter = parameters[i].split(':'); | ||
encodedParameters.push(encodeURIComponent(parameter[0]) + ':' + encodeURIComponent(parameter[1])); | ||
} | ||
_.forOwn(parameters, function(parameterValue, parameterName) { | ||
encodedParameters.push(encodeURIComponent(parameterName) + ':' + encodeURIComponent(parameterValue)); | ||
}); | ||
url += encodedParameters.join('|'); | ||
@@ -52,2 +50,3 @@ url += '&'; | ||
var json = ''; | ||
console.log(url); | ||
https.get(url, function(comScoreResponse) { | ||
@@ -58,2 +57,3 @@ comScoreResponse.on('data', function(chunk) { | ||
comScoreResponse.on('end', function() { | ||
console.log(json); | ||
json = JSON.parse(json); | ||
@@ -60,0 +60,0 @@ if (typeof json.ERROR !== 'undefined') { |
@@ -30,3 +30,5 @@ 'use strict'; | ||
startdate: 20141001, | ||
parameters: 'page:*' | ||
parameters: { | ||
page: '*' | ||
} | ||
}; | ||
@@ -78,3 +80,5 @@ mock.comscoreReport(params, 200, fixtures.report('valid')); | ||
startdate: 20141001, | ||
parameters: 'page:*' | ||
parameters: { | ||
page: '*' | ||
} | ||
}; | ||
@@ -81,0 +85,0 @@ var expectedData = [{ |
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
21446
617
38