From fee78e8496382a549c920dbef99e8240274ba74c Mon Sep 17 00:00:00 2001 From: jsnellbaker <31102355+jsnellbaker@users.noreply.github.com> Date: Tue, 12 Nov 2019 14:39:03 -0500 Subject: [PATCH] add support for min_height field in pbs native requests (#4434) --- modules/prebidServerBidAdapter/index.js | 7 ++-- .../modules/prebidServerBidAdapter_spec.js | 35 ++++++++++++++++++- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/modules/prebidServerBidAdapter/index.js b/modules/prebidServerBidAdapter/index.js index 638918ef7af..151e880e985 100644 --- a/modules/prebidServerBidAdapter/index.js +++ b/modules/prebidServerBidAdapter/index.js @@ -510,10 +510,11 @@ const OPEN_RTB_PROTOCOL = { type: imgTypeId, w: utils.deepAccess(params, 'sizes.0'), h: utils.deepAccess(params, 'sizes.1'), - wmin: utils.deepAccess(params, 'aspect_ratios.0.min_width') + wmin: utils.deepAccess(params, 'aspect_ratios.0.min_width'), + hmin: utils.deepAccess(params, 'aspect_ratios.0.min_height') }); - if (!(asset.w || asset.wmin)) { - throw 'invalid img sizes (must provided sizes or aspect_ratios)'; + if (!((asset.w && asset.h) || (asset.hmin && asset.wmin))) { + throw 'invalid img sizes (must provide sizes or min_height & min_width if using aspect_ratios)'; } if (Array.isArray(params.aspect_ratios)) { // pass aspect_ratios as ext data I guess? diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js index e99da15ea0d..76860a09ee2 100644 --- a/test/spec/modules/prebidServerBidAdapter_spec.js +++ b/test/spec/modules/prebidServerBidAdapter_spec.js @@ -41,6 +41,15 @@ const REQUEST = { 'required': true, 'sizes': [989, 742], }, + 'icon': { + 'required': true, + 'aspect_ratios': [{ + 'min_height': 10, + 'min_width': 10, + 'ratio_height': 1, + 'ratio_width': 1 + }] + }, 'sponsoredBy': { 'required': true } @@ -418,6 +427,19 @@ const RESPONSE_OPENRTB_NATIVE = { } } }, + { + 'id': 2, + 'img': { + 'url': 'https://vcdn.adnxs.com/p/creative-image/1a/3e/e9/5b/1a3ee95b-06cd-4260-98c7-0258627c9197.png', + 'w': 127, + 'h': 83, + 'ext': { + 'appnexus': { + 'prevent_crop': 0 + } + } + } + }, { 'id': 0, 'title': { @@ -425,7 +447,7 @@ const RESPONSE_OPENRTB_NATIVE = { } }, { - 'id': 2, + 'id': 3, 'data': { 'value': 'Prebid.org' } @@ -829,6 +851,17 @@ describe('S2S Adapter', function () { 'h': 742 } }, + { + 'required': 1, + 'img': { + 'type': 1, + 'wmin': 10, + 'hmin': 10, + 'ext': { + 'aspectratios': ['1:1'] + } + } + }, { 'required': 1, 'data': {