Skip to content

Commit

Permalink
pubGENIUS bid adapter: support floor module (prebid#6555)
Browse files Browse the repository at this point in the history
  • Loading branch information
edmonl authored and marc_tappx committed Apr 13, 2021
1 parent 87a3338 commit 62ea47c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
15 changes: 11 additions & 4 deletions modules/pubgeniusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
deepSetValue,
inIframe,
isArrayOfNums,
isFn,
isInteger,
isNumber,
isStr,
logError,
parseQueryStringParameters,
Expand Down Expand Up @@ -185,9 +185,16 @@ function buildImp(bid) {
imp.video = buildVideoParams(bid.mediaTypes.video, bid.params.video);
}

const bidFloor = bid.params.bidFloor;
if (isNumber(bidFloor)) {
imp.bidfloor = bidFloor;
if (isFn(bid.getFloor)) {
const { floor } = bid.getFloor({
mediaType: bid.mediaTypes.banner ? 'banner' : 'video',
size: '*',
currency: 'USD',
});

if (floor) {
imp.bidfloor = floor;
}
}

const pos = bid.params.position;
Expand Down
4 changes: 0 additions & 4 deletions modules/pubgeniusBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Module that connects to pubGENIUS's demand sources

# Test Parameters

Test bids have $0.01 CPM by default. Use `bidFloor` in bidder params to control CPM for testing purposes.

```
var adUnits = [
{
Expand Down Expand Up @@ -45,7 +43,6 @@ var adUnits = [
bidder: 'pubgenius',
params: {
adUnitId: '1000',
bidFloor: 0.5,
test: true
}
}
Expand All @@ -66,7 +63,6 @@ var adUnits = [
bidder: 'pubgenius',
params: {
adUnitId: '1001',
bidFloor: 1,
test: true,
// other video parameters as in OpenRTB v2.5 spec
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/pubgeniusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ describe('pubGENIUS adapter', () => {
expect(buildRequests([bidRequest, bidRequest1], bidderRequest)).to.deep.equal(expectedRequest);
});

it('should take bid floor in bidder params', () => {
bidRequest.params.bidFloor = 0.5;
it('should take bid floor from getFloor interface', () => {
bidRequest.getFloor = () => ({ floor: 0.5, currency: 'USD' });
expectedRequest.data.imp[0].bidfloor = 0.5;

expect(buildRequests([bidRequest], bidderRequest)).to.deep.equal(expectedRequest);
Expand Down

0 comments on commit 62ea47c

Please sign in to comment.