Skip to content

Commit 908872d

Browse files
YakirLavinoamtzuberinoamtzuLaslo ChechurOronW
authored
MinuteMedia Bid Adapter: support missing params and tests (prebid#10195)
* add Rise adapter * fixes * change param isOrg to org * Rise adapter * change email for rise * fix circle failed * bump * bump * bump * remove space * Upgrade Rise adapter to 5.0 * added isWrapper param * addes is_wrapper parameter to documentation * added is_wrapper to test * removed isWrapper * Rise Bid Adapter: support Coppa param (#24) * MinuteMedia Bid Adapter: support Coppa param (#25) * Revert "MinuteMedia Bid Adapter: support Coppa param (#25)" (#26) This reverts commit 66c4e7b. * bump * update coppa fetch * setting coppa param update * update Coppa tests * update test naming * Rise Bid Adapter: support plcmt and sua (#27) * update minuteMediaBidAdapter - support missing params (#29) --------- Co-authored-by: Noam Tzuberi <[email protected]> Co-authored-by: noamtzu <[email protected]> Co-authored-by: Noam Tzuberi <[email protected]> Co-authored-by: Laslo Chechur <[email protected]> Co-authored-by: OronW <[email protected]> Co-authored-by: lasloche <[email protected]> Co-authored-by: inna <[email protected]> Co-authored-by: YakirLavi <[email protected]>
1 parent b38612f commit 908872d

File tree

2 files changed

+53
-7
lines changed

2 files changed

+53
-7
lines changed

modules/minutemediaBidAdapter.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ function generateBidParameters(bid, bidderRequest) {
307307
bidObject.placementId = placementId;
308308
}
309309

310+
const mimes = deepAccess(bid, `mediaTypes.${mediaType}.mimes`);
311+
if (mimes) {
312+
bidObject.mimes = mimes;
313+
}
314+
const api = deepAccess(bid, `mediaTypes.${mediaType}.api`);
315+
if (api) {
316+
bidObject.api = api;
317+
}
318+
310319
const sua = deepAccess(bid, `ortb2.device.sua`);
311320
if (sua) {
312321
bidObject.sua = sua;
@@ -358,6 +367,11 @@ function generateBidParameters(bid, bidderRequest) {
358367
bidObject.linearity = linearity;
359368
}
360369

370+
const protocols = deepAccess(bid, `mediaTypes.video.protocols`);
371+
if (protocols) {
372+
bidObject.protocols = protocols;
373+
}
374+
361375
const plcmt = deepAccess(bid, `mediaTypes.video.plcmt`);
362376
if (plcmt) {
363377
bidObject.plcmt = plcmt;
@@ -398,7 +412,8 @@ function generateGeneralParams(generalObject, bidderRequest) {
398412
dnt: (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0,
399413
device_type: getDeviceType(navigator.userAgent),
400414
ua: navigator.userAgent,
401-
session_id: getBidIdParameter('bidderRequestId', generalObject),
415+
is_wrapper: !!generalBidParams.isWrapper,
416+
session_id: generalBidParams.sessionId || getBidIdParameter('bidderRequestId', generalObject),
402417
tmax: timeout
403418
}
404419

@@ -441,7 +456,7 @@ function generateGeneralParams(generalObject, bidderRequest) {
441456

442457
if (bidderRequest && bidderRequest.refererInfo) {
443458
generalParams.referrer = deepAccess(bidderRequest, 'refererInfo.ref');
444-
generalParams.page_url = deepAccess(bidderRequest, 'refererInfo.page') || window.location.href
459+
generalParams.page_url = deepAccess(bidderRequest, 'refererInfo.page') || deepAccess(window, 'location.href');
445460
}
446461

447462
return generalParams

test/spec/modules/minutemediaBidAdapter_spec.js

+36-5
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,32 @@ describe('minutemediaAdapter', function () {
104104
bidderCode: 'minutemedia',
105105
}
106106
const placementId = '12345678';
107+
const api = [1, 2];
108+
const mimes = ['application/javascript', 'video/mp4', 'video/quicktime'];
109+
const protocols = [2, 3, 5, 6];
107110

108111
it('sends the placementId to ENDPOINT via POST', function () {
109112
bidRequests[0].params.placementId = placementId;
110113
const request = spec.buildRequests(bidRequests, bidderRequest);
111114
expect(request.data.bids[0].placementId).to.equal(placementId);
112115
});
113116

114-
it('sends bid request to ENDPOINT via POST', function () {
117+
it('sends the plcmt to ENDPOINT via POST', function () {
115118
const request = spec.buildRequests(bidRequests, bidderRequest);
116-
expect(request.url).to.equal(ENDPOINT);
117-
expect(request.method).to.equal('POST');
119+
expect(request.data.bids[0].plcmt).to.equal(1);
118120
});
119121

120-
it('sends the plcmt to ENDPOINT via POST', function () {
122+
it('sends the is_wrapper parameter to ENDPOINT via POST', function() {
121123
const request = spec.buildRequests(bidRequests, bidderRequest);
122-
expect(request.data.bids[0].plcmt).to.equal(1);
124+
expect(request.data.params).to.be.an('object');
125+
expect(request.data.params).to.have.property('is_wrapper');
126+
expect(request.data.params.is_wrapper).to.equal(false);
127+
});
128+
129+
it('sends bid request to ENDPOINT via POST', function () {
130+
const request = spec.buildRequests(bidRequests, bidderRequest);
131+
expect(request.url).to.equal(ENDPOINT);
132+
expect(request.method).to.equal('POST');
123133
});
124134

125135
it('sends bid request to TEST ENDPOINT via POST', function () {
@@ -133,6 +143,27 @@ describe('minutemediaAdapter', function () {
133143
expect(request.data.bids[0].bidId).to.equal('299ffc8cca0b87');
134144
});
135145

146+
it('should send the correct supported api array', function () {
147+
bidRequests[0].mediaTypes.video.api = api;
148+
const request = spec.buildRequests(bidRequests, bidderRequest);
149+
expect(request.data.bids[0].api).to.be.an('array');
150+
expect(request.data.bids[0].api).to.eql([1, 2]);
151+
});
152+
153+
it('should send the correct mimes array', function () {
154+
bidRequests[1].mediaTypes.banner.mimes = mimes;
155+
const request = spec.buildRequests(bidRequests, bidderRequest);
156+
expect(request.data.bids[1].mimes).to.be.an('array');
157+
expect(request.data.bids[1].mimes).to.eql(['application/javascript', 'video/mp4', 'video/quicktime']);
158+
});
159+
160+
it('should send the correct protocols array', function () {
161+
bidRequests[0].mediaTypes.video.protocols = protocols;
162+
const request = spec.buildRequests(bidRequests, bidderRequest);
163+
expect(request.data.bids[0].protocols).to.be.an('array');
164+
expect(request.data.bids[0].protocols).to.eql([2, 3, 5, 6]);
165+
});
166+
136167
it('should send the correct sizes array', function () {
137168
const request = spec.buildRequests(bidRequests, bidderRequest);
138169
expect(request.data.bids[0].sizes).to.be.an('array');

0 commit comments

Comments
 (0)