Skip to content

Commit

Permalink
Supporting Alias via Video Requests (prebid#4460)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrmartinez authored and sa1omon committed Nov 28, 2019
1 parent e979093 commit 85c2f6d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
12 changes: 10 additions & 2 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const spec = {
id: bidRequest.adUnitCode,
secure: 1,
ext: {
rubicon: bidRequest.params
[bidRequest.bidder]: bidRequest.params
},
video: utils.deepAccess(bidRequest, 'mediaTypes.video') || {}
}],
Expand All @@ -175,12 +175,20 @@ export const spec = {
}
}
}

// Add alias if it is there
if (bidRequest.bidder !== 'rubicon') {
data.ext.prebid.aliases = {
[bidRequest.bidder]: 'rubicon'
}
}

const bidFloor = parseFloat(utils.deepAccess(bidRequest, 'params.floor'));
if (!isNaN(bidFloor)) {
data.imp[0].bidfloor = bidFloor;
}
// if value is set, will overwrite with same value
data.imp[0].ext.rubicon.video.size_id = determineRubiconVideoSizeId(bidRequest)
data.imp[0].ext[bidRequest.bidder].video.size_id = determineRubiconVideoSizeId(bidRequest)

appendSiteAppDevice(data, bidRequest, bidderRequest);

Expand Down
16 changes: 16 additions & 0 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,22 @@ describe('the rubicon adapter', function () {
expect(post.ext.prebid.cache.vastxml.returnCreative).to.equal(false)
});

it('should add alias name to PBS Request', function() {
createVideoBidderRequest();

bidderRequest.bidderCode = 'superRubicon';
bidderRequest.bids[0].bidder = 'superRubicon';
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);

// should have the aliases object sent to PBS
expect(request.data.ext.prebid).to.haveOwnProperty('aliases');
expect(request.data.ext.prebid.aliases).to.deep.equal({superRubicon: 'rubicon'});

// should have the imp ext bidder params be under the alias name not rubicon superRubicon
expect(request.data.imp[0].ext).to.have.property('superRubicon').that.is.an('object');
expect(request.data.imp[0].ext).to.not.haveOwnProperty('rubicon');
});

it('should send correct bidfloor to PBS', function() {
createVideoBidderRequest();

Expand Down

0 comments on commit 85c2f6d

Please sign in to comment.