From a6f8634ca0705edfd67f54515a99ccace0ad5a29 Mon Sep 17 00:00:00 2001 From: LeoWu Date: Tue, 27 Mar 2018 10:03:56 +0800 Subject: [PATCH] [FEAT] adunit sizes support --- modules/bridgewellBidAdapter.js | 7 ++++++- modules/bridgewellBidAdapter.md | 11 ++++++++++ .../spec/modules/bridgewellBidAdapter_spec.js | 21 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/modules/bridgewellBidAdapter.js b/modules/bridgewellBidAdapter.js index faf93f1037e..2a7dc0b35c3 100644 --- a/modules/bridgewellBidAdapter.js +++ b/modules/bridgewellBidAdapter.js @@ -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 }); }); diff --git a/modules/bridgewellBidAdapter.md b/modules/bridgewellBidAdapter.md index 1ca61ac6c77..b9d065054fa 100644 --- a/modules/bridgewellBidAdapter.md +++ b/modules/bridgewellBidAdapter.md @@ -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' + } + } + ] } ]; ``` diff --git a/test/spec/modules/bridgewellBidAdapter_spec.js b/test/spec/modules/bridgewellBidAdapter_spec.js index cbe4a543816..6b95b44dfe5 100644 --- a/test/spec/modules/bridgewellBidAdapter_spec.js +++ b/test/spec/modules/bridgewellBidAdapter_spec.js @@ -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); @@ -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': '
test 728x90
', + 'ttl': 360, + 'net_revenue': 'true', + 'currency': 'NTD' }]; it('should return all required parameters', () => {