Skip to content

Commit

Permalink
RTBhouse Bid Adapter update for 3.0 (prebid#4428)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcian123 authored and sa1omon committed Nov 28, 2019
1 parent 16fc707 commit 065839d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
7 changes: 4 additions & 3 deletions modules/rtbhouseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ function mapBanner(slot) {
if (slot.mediaType === 'banner' ||
utils.deepAccess(slot, 'mediaTypes.banner') ||
(!slot.mediaType && !slot.mediaTypes)) {
var sizes = slot.sizes || slot.mediaTypes.banner.sizes;
return {
w: slot.sizes[0][0],
h: slot.sizes[0][1],
format: slot.sizes.map(size => ({
w: sizes[0][0],
h: sizes[0][1],
format: sizes.map(size => ({
w: size[0],
h: size[1]
}))
Expand Down
6 changes: 5 additions & 1 deletion modules/rtbhouseBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Please reach out to [email protected] to receive your own
// banner
{
code: 'test-div',
sizes: [[300, 250]],
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
},
bids: [
{
bidder: "rtbhouse",
Expand Down
19 changes: 17 additions & 2 deletions test/spec/modules/rtbhouseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ describe('RTBHouseAdapter', () => {
'region': 'prebid-eu'
},
'adUnitCode': 'adunit-code',
'sizes': [[300, 250], [300, 600]],
'mediaTypes': {
'banner': {
'sizes': [[300, 250], [300, 600]],
}
},
'bidId': '30b31c1838de1e',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475'
Expand All @@ -29,6 +33,13 @@ describe('RTBHouseAdapter', () => {
expect(spec.isBidRequestValid(bid)).to.equal(true);
});

it('Checking backward compatibility. should return true', function () {
let bid2 = Object.assign({}, bid);
delete bid2.mediaTypes;
bid2.sizes = [[300, 250], [300, 600]];
expect(spec.isBidRequestValid(bid2)).to.equal(true);
});

it('should return false when required params are not passed', function () {
let bid = Object.assign({}, bid);
delete bid.params;
Expand All @@ -49,7 +60,11 @@ describe('RTBHouseAdapter', () => {
'test': 1
},
'adUnitCode': 'adunit-code',
'sizes': [[300, 250], [300, 600]],
'mediaTypes': {
'banner': {
'sizes': [[300, 250], [300, 600]],
}
},
'bidId': '30b31c1838de1e',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
Expand Down

0 comments on commit 065839d

Please sign in to comment.