From 965e5cf721f465d6284ef1b5d88eead0585a0ed1 Mon Sep 17 00:00:00 2001 From: Paris Holley Date: Mon, 25 Mar 2019 12:59:43 -0400 Subject: [PATCH 1/2] support dynamic TTL from server --- modules/mantisBidAdapter.js | 2 +- test/spec/modules/mantisBidAdapter_spec.js | 75 ++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/modules/mantisBidAdapter.js b/modules/mantisBidAdapter.js index 4d40dc3af76..ff83c6bbb07 100644 --- a/modules/mantisBidAdapter.js +++ b/modules/mantisBidAdapter.js @@ -252,7 +252,7 @@ const spec = { width: ad.width, height: ad.height, ad: ad.html, - ttl: 86400, + ttl: ad.ttl || serverResponse.body.ttl || 86400, creativeId: ad.view, netRevenue: true, currency: 'USD' diff --git a/test/spec/modules/mantisBidAdapter_spec.js b/test/spec/modules/mantisBidAdapter_spec.js index 464cea2aab3..df2c6bb9a13 100644 --- a/test/spec/modules/mantisBidAdapter_spec.js +++ b/test/spec/modules/mantisBidAdapter_spec.js @@ -128,6 +128,81 @@ describe('MantisAdapter', function () { }); describe('interpretResponse', function () { + it('use ad ttl if provided', function () { + let response = { + body: { + ttl: 360, + uuid: 'uuid', + ads: [ + { + bid: 'bid', + cpm: 1, + view: 'view', + width: 300, + ttl: 250, + height: 250, + html: '' + } + ] + } + }; + + let expectedResponse = [ + { + requestId: 'bid', + cpm: 1, + width: 300, + height: 250, + ttl: 250, + ad: '', + creativeId: 'view', + netRevenue: true, + currency: 'USD' + } + ]; + let bidderRequest; + + let result = spec.interpretResponse(response, {bidderRequest}); + expect(result[0]).to.deep.equal(expectedResponse[0]); + }); + + it('use global ttl if provded', function () { + let response = { + body: { + ttl: 360, + uuid: 'uuid', + ads: [ + { + bid: 'bid', + cpm: 1, + view: 'view', + width: 300, + height: 250, + html: '' + } + ] + } + }; + + let expectedResponse = [ + { + requestId: 'bid', + cpm: 1, + width: 300, + height: 250, + ttl: 360, + ad: '', + creativeId: 'view', + netRevenue: true, + currency: 'USD' + } + ]; + let bidderRequest; + + let result = spec.interpretResponse(response, {bidderRequest}); + expect(result[0]).to.deep.equal(expectedResponse[0]); + }); + it('display ads returned', function () { let response = { body: { From c8cc5e483be3ba859f27d1c1223c3be946f91ca6 Mon Sep 17 00:00:00 2001 From: Paris Holley Date: Mon, 25 Mar 2019 13:29:59 -0400 Subject: [PATCH 2/2] version bump --- modules/mantisBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mantisBidAdapter.js b/modules/mantisBidAdapter.js index ff83c6bbb07..2f6b892194a 100644 --- a/modules/mantisBidAdapter.js +++ b/modules/mantisBidAdapter.js @@ -168,7 +168,7 @@ function buildMantisUrl(path, data, domain) { tz: new Date().getTimezoneOffset(), buster: new Date().getTime(), secure: isSecure(), - version: 8 + version: 9 }; if (!inIframe() || isAmp()) { params.mobile = !isAmp() && isDesktop(true) ? 'false' : 'true';