Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rise Bid Adapter: add support for mimes, api, protocols in bid object #9253

Merged
merged 9 commits into from
Nov 22, 2022
15 changes: 15 additions & 0 deletions modules/riseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,16 @@ function generateBidParameters(bid, bidderRequest) {
bidObject.placementId = placementId;
}

const mimes = deepAccess(bid, `mediaTypes.${mediaType}.mimes`);
if (mimes) {
bidObject.mimes = mimes;
}

const api = deepAccess(bid, `mediaTypes.${mediaType}.api`);
if (api) {
bidObject.api = api;
}

if (mediaType === VIDEO) {
const playbackMethod = deepAccess(bid, `mediaTypes.video.playbackmethod`);
let playbackMethodValue;
Expand Down Expand Up @@ -349,6 +359,11 @@ function generateBidParameters(bid, bidderRequest) {
if (linearity) {
bidObject.linearity = linearity;
}

const protocols = deepAccess(bid, `mediaTypes.video.protocols`);
if (protocols) {
bidObject.protocols = protocols;
}
}

return bidObject;
Expand Down
24 changes: 24 additions & 0 deletions test/spec/modules/riseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ describe('riseAdapter', function () {
bidderCode: 'rise',
}
const placementId = '12345678';
const api = [1, 2];
const mimes = ['application/javascript', 'video/mp4', 'video/quicktime'];
const protocols = [2, 3, 5, 6];

it('sends the placementId to ENDPOINT via POST', function () {
bidRequests[0].params.placementId = placementId;
Expand Down Expand Up @@ -144,6 +147,27 @@ describe('riseAdapter', function () {
expect(request.data.bids[0].bidId).to.equal('299ffc8cca0b87');
});

it('should send the correct supported api array', function () {
bidRequests[0].mediaTypes.video.api = api;
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bids[0].api).to.be.an('array');
expect(request.data.bids[0].api).to.eql([1, 2]);
});

it('should send the correct mimes array', function () {
bidRequests[1].mediaTypes.banner.mimes = mimes;
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bids[1].mimes).to.be.an('array');
expect(request.data.bids[1].mimes).to.eql(['application/javascript', 'video/mp4', 'video/quicktime']);
});

it('should send the correct protocols array', function () {
bidRequests[0].mediaTypes.video.protocols = protocols;
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bids[0].protocols).to.be.an('array');
expect(request.data.bids[0].protocols).to.eql([2, 3, 5, 6]);
});

it('should send the correct sizes array', function () {
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bids[0].sizes).to.be.an('array');
Expand Down