From 140b538ddc4b35ef29d26d89f0a8948cd951273f Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 29 May 2019 09:29:39 +0200 Subject: [PATCH 1/4] Remove useless bidderCode in bid response --- modules/adyoulikeBidAdapter.js | 1 - test/spec/modules/adyoulikeBidAdapter_spec.js | 5 ----- 2 files changed, 6 deletions(-) diff --git a/modules/adyoulikeBidAdapter.js b/modules/adyoulikeBidAdapter.js index 4624bdba8b5..fd7a1697bac 100644 --- a/modules/adyoulikeBidAdapter.js +++ b/modules/adyoulikeBidAdapter.js @@ -187,7 +187,6 @@ function createBid(response) { return { requestId: response.BidID, - bidderCode: spec.code, width: response.Width, height: response.Height, ad: response.Ad, diff --git a/test/spec/modules/adyoulikeBidAdapter_spec.js b/test/spec/modules/adyoulikeBidAdapter_spec.js index 3f28acaaf97..7edb9416b03 100644 --- a/test/spec/modules/adyoulikeBidAdapter_spec.js +++ b/test/spec/modules/adyoulikeBidAdapter_spec.js @@ -7,7 +7,6 @@ import { newBidder } from 'src/adapters/bidderFactory'; describe('Adyoulike Adapter', function () { const canonicalUrl = 'http://canonical.url/?t=%26'; const defaultDC = 'hb-api'; - const bidderCode = 'adyoulike'; const bidRequestWithEmptyPlacement = [ { 'bidId': 'bid_id_0', @@ -18,7 +17,6 @@ describe('Adyoulike Adapter', function () { } ]; const bidRequestWithEmptySizes = { - 'bidderCode': 'adyoulike', 'bids': [ { 'bidId': 'bid_id_0', @@ -193,7 +191,6 @@ describe('Adyoulike Adapter', function () { it('should add gdpr consent information to the request', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; let bidderRequest = { - 'bidderCode': 'adyoulike', 'auctionId': '1d1a030790a475', 'bidderRequestId': '22edbae2733bf6', 'timeout': 3000, @@ -306,13 +303,11 @@ describe('Adyoulike Adapter', function () { expect(result.length).to.equal(2); - expect(result[0].bidderCode).to.equal(bidderCode); expect(result[0].cpm).to.equal(0.5); expect(result[0].ad).to.equal('placement_0'); expect(result[0].width).to.equal(300); expect(result[0].height).to.equal(300); - expect(result[1].bidderCode).to.equal(bidderCode); expect(result[1].cpm).to.equal(0.6); expect(result[1].ad).to.equal('placement_1'); expect(result[1].width).to.equal(300); From e4a5f63b7bb4fe90ef2111e0bffa7ea25157b32f Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 22 Jul 2019 11:10:43 +0200 Subject: [PATCH 2/4] send all the available sizes in the bid request --- modules/adyoulikeBidAdapter.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/adyoulikeBidAdapter.js b/modules/adyoulikeBidAdapter.js index fd7a1697bac..0f0fb3eca33 100644 --- a/modules/adyoulikeBidAdapter.js +++ b/modules/adyoulikeBidAdapter.js @@ -18,7 +18,7 @@ export const spec = { * @return boolean True if this is a valid bid, and false otherwise. */ isBidRequestValid: function (bid) { - const sizes = getSize(bid.sizes); + const sizes = getSize(utils.parseSizesInput(bid.sizes)); if (!bid.params || !bid.params.placement || !sizes.width || !sizes.height) { return false; } @@ -34,12 +34,14 @@ export const spec = { const payload = { Version: VERSION, Bids: bidRequests.reduce((accumulator, bid) => { - let size = getSize(bid.sizes); + let sizesArray = utils.parseSizesInput(bid.sizes); + let size = getSize(sizesArray); accumulator[bid.bidId] = {}; accumulator[bid.bidId].PlacementID = bid.params.placement; accumulator[bid.bidId].TransactionID = bid.transactionId; accumulator[bid.bidId].Width = size.width; accumulator[bid.bidId].Height = size.height; + accumulator[bid.bidId].AvaiableSizes = sizesArray.join(','); return accumulator; }, {}), PageRefreshed: getPageRefreshed() @@ -157,9 +159,10 @@ function createEndpointQS(bidderRequest) { } /* Get parsed size from request size */ -function getSize(requestSizes) { +function getSize(sizesArray) { const parsed = {}; - const size = utils.parseSizesInput(requestSizes)[0]; + // the main requested size is the first one + const size = sizesArray[0]; if (typeof size !== 'string') { return parsed; From edf4cd3f20736cce0b3ea1b74f9c6bcdb5c80ceb Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 25 Jul 2019 16:40:03 +0200 Subject: [PATCH 3/4] Use the banner sizes if given --- modules/adyoulikeBidAdapter.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/adyoulikeBidAdapter.js b/modules/adyoulikeBidAdapter.js index 0f0fb3eca33..7a6b4c0e5fd 100644 --- a/modules/adyoulikeBidAdapter.js +++ b/modules/adyoulikeBidAdapter.js @@ -18,7 +18,7 @@ export const spec = { * @return boolean True if this is a valid bid, and false otherwise. */ isBidRequestValid: function (bid) { - const sizes = getSize(utils.parseSizesInput(bid.sizes)); + const sizes = getSize(getSizeArray(bid)); if (!bid.params || !bid.params.placement || !sizes.width || !sizes.height) { return false; } @@ -34,7 +34,7 @@ export const spec = { const payload = { Version: VERSION, Bids: bidRequests.reduce((accumulator, bid) => { - let sizesArray = utils.parseSizesInput(bid.sizes); + let sizesArray = getSizeArray(bid); let size = getSize(sizesArray); accumulator[bid.bidId] = {}; accumulator[bid.bidId].PlacementID = bid.params.placement; @@ -158,6 +158,15 @@ function createEndpointQS(bidderRequest) { return qs; } +function getSizeArray(bid) { + let inputSize = bid.sizes; + if (bid.mediaTypes.banner) { + inputSize = bid.mediaTypes.banner.sizes; + } + + return utils.parseSizesInput(inputSize); +} + /* Get parsed size from request size */ function getSize(sizesArray) { const parsed = {}; From 008ded4d2b4bfa896de06fb2f5b51d2fc57b8710 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 25 Jul 2019 16:49:42 +0200 Subject: [PATCH 4/4] avoid compatibility issue with old bid format --- modules/adyoulikeBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/adyoulikeBidAdapter.js b/modules/adyoulikeBidAdapter.js index 7a6b4c0e5fd..12891b6e155 100644 --- a/modules/adyoulikeBidAdapter.js +++ b/modules/adyoulikeBidAdapter.js @@ -160,7 +160,7 @@ function createEndpointQS(bidderRequest) { function getSizeArray(bid) { let inputSize = bid.sizes; - if (bid.mediaTypes.banner) { + if (bid.mediaTypes && bid.mediaTypes.banner) { inputSize = bid.mediaTypes.banner.sizes; }