Skip to content

Commit

Permalink
GumGum: adds new param (prebid#5297)
Browse files Browse the repository at this point in the history
* adds in new videoPubID param

* adds test
  • Loading branch information
susyt authored and iggyfisk committed Jun 22, 2020
1 parent e43a1b3 commit 6ff668e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function isBidRequestValid (bid) {
case !!(params.ICV): break;
case !!(params.video): break;
case !!(params.inVideo): break;

case !!(params.videoPubID): break;
default:
utils.logWarn(`[GumGum] No product selected for the placement ${adUnitCode}, please check your implementation.`);
return false;
Expand Down Expand Up @@ -244,6 +244,11 @@ function buildRequests (validBidRequests, bidderRequest) {
data.ni = parseInt(params.ICV, 10);
data.pi = 5;
}
if (params.videoPubID) {
data = Object.assign(data, _getVidParams(mediaTypes.video));
data.pubId = params.videoPubID;
data.pi = 7;
}
if (params.video) {
data = Object.assign(data, _getVidParams(mediaTypes.video));
data.t = params.video;
Expand Down
21 changes: 21 additions & 0 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,27 @@ describe('gumgumAdapter', function () {
expect(bidRequest.data.pubId).to.equal(request.params.inScreenPubID);
expect(bidRequest.data).to.not.include.any.keys('t');
});
it('should send pubId if videoPubID param is specified', function () {
const mediaTypes = {
video: {
playerSize: [640, 480],
context: 'instream',
minduration: 1,
maxduration: 2,
linearity: 1,
startdelay: 1,
placement: 123456,
protocols: [1, 2]
}
};
const request = Object.assign({}, bidRequests[0]);
request.mediaTypes = mediaTypes
request.params = { 'videoPubID': 123 };
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.include.any.keys('pubId');
expect(bidRequest.data.pubId).to.equal(request.params.videoPubID);
expect(bidRequest.data).to.not.include.any.keys('t');
});
it('should set a ni parameter in bid request if ICV request param is found', function () {
const request = Object.assign({}, bidRequests[0]);
delete request.params;
Expand Down

0 comments on commit 6ff668e

Please sign in to comment.