Skip to content

Commit

Permalink
Rhythmone Adapter - schain support (prebid#4414)
Browse files Browse the repository at this point in the history
Circle CI failing tests are not related to this PR.
  • Loading branch information
rhythmonebhaines authored and afewcc committed Dec 10, 2019
1 parent 2ff4069 commit 8f9fa39
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/rhythmoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function RhythmOneBidAdapter() {
}

function frameBid(BRs, bidderRequest) {
return {
let bid = {
id: BRs[0].bidderRequestId,
imp: frameImp(BRs, bidderRequest),
site: frameSite(bidderRequest),
Expand All @@ -181,6 +181,14 @@ function RhythmOneBidAdapter() {
}
}
};
if (BRs[0].schain) {
bid.source = {
'ext': {
'schain': BRs[0].schain
}
}
}
return bid;
}

function getFirstParam(key, validBidRequests) {
Expand Down
40 changes: 40 additions & 0 deletions test/spec/modules/rhythmoneBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,46 @@ describe('rhythmone adapter tests', function () {
expect(openrtbRequest.imp[0].secure).to.equal(1);
});

it('should pass schain', function() {
var schain = {
'ver': '1.0',
'complete': 1,
'nodes': [{
'asi': 'indirectseller.com',
'sid': '00001',
'hp': 1
}, {
'asi': 'indirectseller-2.com',
'sid': '00002',
'hp': 1
}]
};
var bidRequestList = [
{
'bidder': 'rhythmone',
'params': {
'placementId': 'myplacement',
'zone': 'myzone',
'path': 'mypath'
},
'mediaType': 'banner',
'adUnitCode': 'div-gpt-ad-1438287399331-0',
'sizes': [[300, 250]],
'transactionId': 'd7b773de-ceaa-484d-89ca-d9f51b8d61ec',
'bidderRequestId': '418b37f85e772c',
'auctionId': '18fd8b8b0bd757',
'bidRequestsCount': 1,
'bidId': '51ef8751f9aead',
'schain': schain
}
];

var bidRequest = r1adapter.buildRequests(bidRequestList, this.defaultBidderRequest);
const openrtbRequest = JSON.parse(bidRequest.data);

expect(openrtbRequest.source.ext.schain).to.deep.equal(schain);
});

describe('misc interpretResponse', function () {
it('No bid response', function() {
var noBidResponse = r1adapter.interpretResponse({
Expand Down

0 comments on commit 8f9fa39

Please sign in to comment.