Skip to content

Commit

Permalink
VidoomyAdapter: add schain and bidfloor to vidoomy adapter (#7965)
Browse files Browse the repository at this point in the history
* feat: add schain and bidfloor to vidoomy adapter

* doc: update vidoomy docs

* fix: add bidfloor validation

* chore: update docs and tests
  • Loading branch information
sasanfarokh authored Feb 9, 2022
1 parent 6317dc3 commit c0c8ebe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 8 additions & 0 deletions modules/vidoomyBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ const isBidRequestValid = bid => {
return false;
}

if (bid.params.bidfloor && (isNaN(bid.params.bidfloor) || bid.params.bidfloor < 0)) {
logError(BIDDER_CODE + ': bid.params.bidfloor should be a number equal or greater than zero');
return false;
}

return true;
};

Expand Down Expand Up @@ -77,6 +82,7 @@ const buildRequests = (validBidRequests, bidderRequest) => {
const hostname = aElement.hostname

const videoContext = deepAccess(bid, 'mediaTypes.video.context');
const bidfloor = deepAccess(bid, `params.bidfloor`, 0);

const queryParams = {
id: bid.params.id,
Expand All @@ -90,6 +96,8 @@ const buildRequests = (validBidRequests, bidderRequest) => {
dt: /Mobi/.test(navigator.userAgent) ? 2 : 1,
pid: bid.params.pid,
requestId: bid.bidId,
schain: bid.schain || '',
bidfloor,
d: getDomainWithoutSubdomain(hostname), // 'vidoomy.com',
sp: encodeURIComponent(aElement.href),
usp: bidderRequest.uspConsent || '',
Expand Down
6 changes: 4 additions & 2 deletions modules/vidoomyBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ var adUnits = [
bidder: 'vidoomy',
params: {
id: '123123',
pid: '123123'
pid: '123123',
bidfloor: 0.5 // This is optional
}
}
]
Expand All @@ -50,7 +51,8 @@ var adUnits = [
bidder: 'vidoomy',
params: {
id: '123123',
pid: '123123'
pid: '123123',
bidfloor: 0.5 // This is optional
}
}
]
Expand Down
8 changes: 7 additions & 1 deletion test/spec/modules/vidoomyBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ describe('vidoomyBidAdapter', function() {
'bidder': 'vidoomy',
'params': {
pid: '123123',
id: '123123'
id: '123123',
bidfloor: 0.5
},
'adUnitCode': 'code',
'sizes': [[300, 250]]
Expand All @@ -32,6 +33,11 @@ describe('vidoomyBidAdapter', function() {
expect(spec.isBidRequestValid(bid)).to.equal(false);
});

it('should return false when bidfloor is invalid', function () {
bid.params.bidfloor = 'not a number';
expect(spec.isBidRequestValid(bid)).to.equal(false);
});

it('should return false when id is empty', function () {
bid.params.id = '';
expect(spec.isBidRequestValid(bid)).to.equal(false);
Expand Down

0 comments on commit c0c8ebe

Please sign in to comment.