Skip to content

Commit

Permalink
[FEAT] adunit sizes support (#2320)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuleo authored and jsnellbaker committed Mar 27, 2018
1 parent feafdcf commit bc94b71
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/bridgewellBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ export const spec = {
return;
}

const anotherFormatSize = []; // for store width and height
let matchedResponse = find(serverResponse.body, function(res) {
return !!res && !res.consumed && find(req.sizes, function(size) {
return res.width === size[0] && res.height === size[1];
let width = res.width;
let height = res.height;
if (typeof size === 'number') anotherFormatSize.push(size); // if sizes format is Array[Number], push width and height into anotherFormatSize
return (width === size[0] && height === size[1]) || // for format Array[Array[Number]] check
(width === anotherFormatSize[0] && height === anotherFormatSize[1]); // for foramt Array[Number] check
});
});

Expand Down
11 changes: 11 additions & 0 deletions modules/bridgewellBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ Module that connects to Bridgewell demand source to fetch bids.
}
}
]
},{
code: 'test-div',
sizes: [728, 90],
bids: [
{
bidder: 'bridgewell',
params: {
ChannelID: 'CgUxMjMzOBIBNiIGcGVubnkzKggI2AUQWhoBOQ'
}
}
]
}
];
```
21 changes: 21 additions & 0 deletions test/spec/modules/bridgewellBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ describe('bridgewellBidAdapter', function () {
'bidId': '3150ccb55da321',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
},
{
'bidder': 'bridgewell',
'params': {
'ChannelID': 'CgUxMjMzOBIBNiIGcGVubnkzKggI2AUQWhoBOQ',
},
'adUnitCode': 'adunit-code-2',
'sizes': [728, 90],
'bidId': '3150ccb55da321',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
}
];
const adapter = newBidder(spec);
Expand Down Expand Up @@ -239,6 +250,16 @@ describe('bridgewellBidAdapter', function () {
'ttl': 360,
'net_revenue': 'true',
'currency': 'NTD'
}, {
'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d',
'bidder_code': 'bridgewell',
'cpm': 5.0,
'width': 728,
'height': 90,
'ad': '<div>test 728x90</div>',
'ttl': 360,
'net_revenue': 'true',
'currency': 'NTD'
}];

it('should return all required parameters', () => {
Expand Down

0 comments on commit bc94b71

Please sign in to comment.