Skip to content

Commit

Permalink
support extra params (#2502)
Browse files Browse the repository at this point in the history
  • Loading branch information
thewizarodofoz authored and harpere committed May 8, 2018
1 parent 2dd6e1a commit b1b969f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
8 changes: 6 additions & 2 deletions modules/vidazooBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function isBidRequestValid(bid) {

function buildRequest(bid, topWindowUrl, size) {
const {params, bidId} = bid;
const {bidFloor, cId, pId} = params;
const {bidFloor, cId, pId, ext} = params;
// Prebid's util function returns AppNexus style sizes (i.e. 300x250)
const [width, height] = size.split('x');

return {
const dto = {
method: 'GET',
url: `${URL}/prebid/${cId}`,
data: {
Expand All @@ -38,6 +38,10 @@ function buildRequest(bid, topWindowUrl, size) {
height
}
}

Object.entries(ext).forEach(entry => dto.data['ext.' + entry[0]] = entry[1]);

return dto;
}

function buildRequests(validBidRequests) {
Expand Down
6 changes: 5 additions & 1 deletion modules/vidazooBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ var adUnits = [
params: {
cId: '5a1c419d95fce900044c334e',
pId: '59ac17c192832d0011283fe3',
bidFloor: 0.0001
bidFloor: 0.0001,
ext: {
param1: 'loremipsum',
param2: 'dolorsitamet'
}
}
}
]
Expand Down
14 changes: 11 additions & 3 deletions test/spec/modules/vidazooBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ const BID = {
'params': {
'cId': '59db6b3b4ffaa70004f45cdc',
'pId': '59ac17c192832d0011283fe3',
'bidFloor': 0.1
'bidFloor': 0.1,
'ext': {
'param1': 'loremipsum',
'param2': 'dolorsitamet'
}
},
'placementCode': 'div-gpt-ad-1460505748561-0',
'transactionId': 'c881914b-a3b5-4ecf-ad9c-1c2f37c6aabf',
Expand Down Expand Up @@ -117,7 +121,9 @@ describe('VidazooBidAdapter', () => {
cb: 1000,
bidFloor: 0.1,
bidId: '2d52001cabd527',
publisherId: '59ac17c192832d0011283fe3'
publisherId: '59ac17c192832d0011283fe3',
'ext.param1': 'loremipsum',
'ext.param2': 'dolorsitamet',
}
});
expect(requests[1]).to.deep.equal({
Expand All @@ -130,7 +136,9 @@ describe('VidazooBidAdapter', () => {
cb: 1000,
bidFloor: 0.1,
bidId: '2d52001cabd527',
publisherId: '59ac17c192832d0011283fe3'
publisherId: '59ac17c192832d0011283fe3',
'ext.param1': 'loremipsum',
'ext.param2': 'dolorsitamet',
}
});
});
Expand Down

0 comments on commit b1b969f

Please sign in to comment.