modules/rubiconBidAdapter.js
function bidType(bid, log = false) {
  // Is it considered video ad unit by rubicon
  if (hasVideoMediaType(bid)) {
    // Removed legacy mediaType support. new way using mediaTypes.video object is now required
    // We require either context as instream or outstream
    if (['outstream', 'instream'].indexOf(utils.deepAccess(bid, `mediaTypes.${VIDEO}.context`)) === -1) {
      if (log) {
        utils.logError('Rubicon bid adapter requires mediaTypes.video.context to be one of outstream or instream');
      }
      return;
    }

    // we require playerWidth and playerHeight to come from one of params.playerWidth/playerHeight or mediaTypes.video.playerSize or adUnit.sizes
    if (parseSizes(bid, 'video').length < 2) {
      if (log) {
        utils.logError('Rubicon bid adapter could not determine the playerSize of the video\nplayerWidth and playerHeight are inferred from one of params.playerWidth/playerHeight or mediaTypes.video.playerSize or adUnit.sizes, in that order');
      }
      return;
    }

    if (log) {
      utils.logMessage('Rubicon bid adapter making video request for adUnit', bid.adUnitCode);
    }
    return 'video';
  } else {
    // we require banner sizes to come from one of params.sizes or mediaTypes.banner.sizes or adUnit.sizes, in that order
    // if we cannot determine them, we reject it!
    if (parseSizes(bid, 'banner').length === 0) {
      if (log) {
        utils.logError('Rubicon bid adapter could not determine the sizes for a banner request\nThey are inferred from one of params.sizes or mediaTypes.banner.sizes or adUnit.sizes, in that order');
      }
      return;
    }

    // everything looks good for banner so lets do it
    if (log) {
      utils.logMessage('Rubicon bid adapter making banner request for adUnit', bid.adUnitCode);
    }
    return 'banner';
  }
}
function bidType(bid, log = false) {
  // Is it considered video ad unit by rubicon
  if (hasVideoMediaType(bid)) {
    // Removed legacy mediaType support. new way using mediaTypes.video object is now required
    // We require either context as instream or outstream
    if (['outstream', 'instream'].indexOf(utils.deepAccess(bid, `mediaTypes.${VIDEO}.context`)) === -1) {
      if (log) {
        utils.logError('Rubicon bid adapter requires mediaTypes.video.context to be one of outstream or instream');
      }
      return;
    }

    // we require playerWidth and playerHeight to come from one of params.playerWidth/playerHeight or mediaTypes.video.playerSize or adUnit.sizes
    if (parseSizes(bid, 'video').length < 2) {
      if (log) {
        utils.logError('Rubicon bid adapter could not determine the playerSize of the video\nplayerWidth and playerHeight are inferred from one of params.playerWidth/playerHeight or mediaTypes.video.playerSize or adUnit.sizes, in that order');
      }
      return;
    }

    if (log) {
      utils.logMessage('Rubicon bid adapter making video request for adUnit', bid.adUnitCode);
    }
    return 'video';
  } else {
    // we require banner sizes to come from one of params.sizes or mediaTypes.banner.sizes or adUnit.sizes, in that order
    // if we cannot determine them, we reject it!
    if (parseSizes(bid, 'banner').length === 0) {
      if (log) {
        utils.logError('Rubicon bid adapter could not determine the sizes for a banner request\nThey are inferred from one of params.sizes or mediaTypes.banner.sizes or adUnit.sizes, in that order');
      }
      return;
    }

    // everything looks good for banner so lets do it
    if (log) {
      utils.logMessage('Rubicon bid adapter making banner request for adUnit', bid.adUnitCode);
    }
    return 'banner';
  }
}
function bidType ( bid , log = false ) { // Is it considered video ad unit by rubicon if ( hasVideoMediaType ( bid ) ) { // Removed legacy mediaType support. new way using mediaTypes.video object is now required // We require either context as instream or outstream if ( [ 'outstream' , 'instream' ] . indexOf ( utils . deepAccess ( bid , ` ${ VIDEO } ` ) ) === - 1 ) { if ( log ) { utils . logError ( 'Rubicon bid adapter requires mediaTypes.video.context to be one of outstream or instream' ) ; } return ; } // we require playerWidth and playerHeight to come from one of params.playerWidth/playerHeight or mediaTypes.video.playerSize or adUnit.sizes if ( parseSizes ( bid , 'video' ) . length < 2 ) { if ( log ) { utils . logError ( 'Rubicon bid adapter could not determine the playerSize of the video\nplayerWidth and playerHeight are inferred from one of params.playerWidth/playerHeight or mediaTypes.video.playerSize or adUnit.sizes, in that order' ) ; } return ; } if ( log ) { utils . logMessage ( 'Rubicon bid adapter making video request for adUnit' , bid . adUnitCode ) ; } return 'video' ; } else { // we require banner sizes to come from one of params.sizes or mediaTypes.banner.sizes or adUnit.sizes, in that order // if we cannot determine them, we reject it! if ( parseSizes ( bid , 'banner' ) . length === 0 ) { if ( log ) { utils . logError ( 'Rubicon bid adapter could not determine the sizes for a banner request\nThey are inferred from one of params.sizes or mediaTypes.banner.sizes or adUnit.sizes, in that order' ) ; } return ; } // everything looks good for banner so lets do it if ( log ) { utils . logMessage ( 'Rubicon bid adapter making banner request for adUnit' , bid . adUnitCode ) ; } return 'banner' ; } }
Determine bidRequest mediaType
@param bid the bid to test
@param log whether we should log errors/warnings for invalid bids
@returns {string|undefined} Returns 'video' or 'banner' if resolves to a type, or undefined otherwise (invalid).
Determine bidRequest mediaType