From 859b38df5560e67db071831a5b6a5a4051505ad3 Mon Sep 17 00:00:00 2001 From: Valentin Zhukovsky Date: Thu, 4 Jan 2018 03:41:07 +0300 Subject: [PATCH] Added dynamic ttl property for One Display and One Mobile. (#2004) --- modules/aolBidAdapter.js | 12 ++++++++---- test/spec/modules/aolBidAdapter_spec.js | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/modules/aolBidAdapter.js b/modules/aolBidAdapter.js index 71b1e4f7902d..9b4aa26e1a1e 100644 --- a/modules/aolBidAdapter.js +++ b/modules/aolBidAdapter.js @@ -39,7 +39,8 @@ const MP_SERVER_MAP = { as: 'adserver-as.adtech.advertising.com' }; const NEXAGE_SERVER = 'hb.nexage.com'; -const BID_RESPONSE_TTL = 300; +const ONE_DISPLAY_TTL = 60; +const ONE_MOBILE_TTL = 3600; $$PREBID_GLOBAL$$.aolGlobals = { pixelsDropped: false @@ -224,7 +225,7 @@ function _parseBidResponse(response, bidRequest) { currency: response.cur, dealId: bidData.dealid, netRevenue: true, - ttl: BID_RESPONSE_TTL + ttl: bidRequest.ttl }; } @@ -274,14 +275,16 @@ function formatBidRequest(endpointCode, bid) { case AOL_ENDPOINTS.DISPLAY.GET: bidRequest = { url: _buildMarketplaceUrl(bid), - method: 'GET' + method: 'GET', + ttl: ONE_DISPLAY_TTL }; break; case AOL_ENDPOINTS.MOBILE.GET: bidRequest = { url: _buildOneMobileGetUrl(bid), - method: 'GET' + method: 'GET', + ttl: ONE_MOBILE_TTL }; break; @@ -289,6 +292,7 @@ function formatBidRequest(endpointCode, bid) { bidRequest = { url: _buildOneMobileBaseUrl(bid), method: 'POST', + ttl: ONE_MOBILE_TTL, data: bid.params, options: { contentType: 'application/json', diff --git a/test/spec/modules/aolBidAdapter_spec.js b/test/spec/modules/aolBidAdapter_spec.js index d05f21a7be48..109c5bf2a0fa 100644 --- a/test/spec/modules/aolBidAdapter_spec.js +++ b/test/spec/modules/aolBidAdapter_spec.js @@ -74,8 +74,10 @@ let getPixels = () => { }; describe('AolAdapter', () => { - const MARKETPLACE_URL = 'adserver-us.adtech.advertising.com/pubapi/3.0/'; - const NEXAGE_URL = 'hb.nexage.com/bidRequest?'; + const MARKETPLACE_URL = '//adserver-us.adtech.advertising.com/pubapi/3.0/'; + const NEXAGE_URL = '//hb.nexage.com/bidRequest?'; + const ONE_DISPLAY_TTL = 60; + const ONE_MOBILE_TTL = 3600; function createCustomBidRequest({bids, params} = {}) { var bidderRequest = getDefaultBidRequest(); @@ -98,7 +100,8 @@ describe('AolAdapter', () => { bidderSettingsBackup = $$PREBID_GLOBAL$$.bidderSettings; bidRequest = { bidderCode: 'test-bidder-code', - bidId: 'bid-id' + bidId: 'bid-id', + ttl: 1234 }; bidResponse = { body: getDefaultBidResponse() @@ -125,7 +128,7 @@ describe('AolAdapter', () => { currency: 'USD', dealId: 'deal-id', netRevenue: true, - ttl: 300 + ttl: bidRequest.ttl }); }); @@ -355,6 +358,13 @@ describe('AolAdapter', () => { let [request] = spec.buildRequests(bidRequest.bids); expect(request.url).to.contain('kvage=25;kvheight=3.42;kvtest=key'); }); + + it('should return request object for One Display when configuration is present', () => { + let bidRequest = getDefaultBidRequest(); + let [request] = spec.buildRequests(bidRequest.bids); + expect(request.method).to.equal('GET'); + expect(request.ttl).to.equal(ONE_DISPLAY_TTL); + }); }); describe('One Mobile', () => { @@ -454,6 +464,7 @@ describe('AolAdapter', () => { let [request] = spec.buildRequests(bidRequest.bids); expect(request.url).to.contain(NEXAGE_URL); expect(request.method).to.equal('POST'); + expect(request.ttl).to.equal(ONE_MOBILE_TTL); expect(request.data).to.deep.equal(bidConfig); expect(request.options).to.deep.equal({ contentType: 'application/json',