Skip to content

Commit

Permalink
Move legacy-specific video code to legcy spec
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlane committed Feb 15, 2018
1 parent bcbc836 commit e20ba0d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions modules/prebidServerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@ function _getDigiTrustQueryParams() {
const LEGACY_PROTOCOL = {

buildRequest(s2sBidRequest, adUnits) {
// pbs expects an ad_unit.video attribute if the imp is video
adUnits.forEach(adUnit => {
const videoMediaType = utils.deepAccess(adUnit, 'mediaTypes.video');
if (videoMediaType) {
adUnit.video = Object.assign({}, videoMediaType);
delete adUnit.mediaTypes;
// default is assumed to be 'banner' so if there is a video type
// we assume video only until PBS can support multi-format auction
adUnit.media_types = [VIDEO];
}
});

const request = {
account_id: _s2sConfig.accountId,
tid: s2sBidRequest.tid,
Expand Down Expand Up @@ -498,17 +510,6 @@ export function PrebidServer() {
baseAdapter.callBids = function(s2sBidRequest, bidRequests, addBidResponse, done, ajax) {
const adUnits = utils.deepClone(s2sBidRequest.ad_units);

adUnits.forEach(adUnit => {
const videoMediaType = utils.deepAccess(adUnit, 'mediaTypes.video');
if (videoMediaType) {
// pbs expects a ad_unit.video attribute if the imp is video
adUnit.video = Object.assign({}, videoMediaType);
delete adUnit.mediaTypes;
// default is assumed to be 'banner' so if there is a video type we assume video only until PBS can support multi format auction.
adUnit.media_types = [VIDEO];
}
});

convertTypes(adUnits);

// at this point ad units should have a size array either directly or mapped so filter for that
Expand Down

0 comments on commit e20ba0d

Please sign in to comment.