Skip to content

Commit

Permalink
MinuteMedia Bid Adapter: support missing params and tests (prebid#10195)
Browse files Browse the repository at this point in the history
* 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 <noam.tzuberi@ironsrc.com>
Co-authored-by: noamtzu <noamtzu@gmail.com>
Co-authored-by: Noam Tzuberi <noamtzu@users.noreply.github.com>
Co-authored-by: Laslo Chechur <laslo.chechur@ironsrc.com>
Co-authored-by: OronW <41260031+OronW@users.noreply.github.com>
Co-authored-by: lasloche <62240785+lasloche@users.noreply.github.com>
Co-authored-by: inna <innayare@gmail.com>
Co-authored-by: YakirLavi <yakir.lavi@risecodes.com>
  • Loading branch information
9 people authored and Santiago Carabone committed Aug 22, 2023
1 parent 443956b commit 255c323
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
19 changes: 17 additions & 2 deletions modules/minutemediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,15 @@ 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;
}

const sua = deepAccess(bid, `ortb2.device.sua`);
if (sua) {
bidObject.sua = sua;
Expand Down Expand Up @@ -358,6 +367,11 @@ function generateBidParameters(bid, bidderRequest) {
bidObject.linearity = linearity;
}

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

const plcmt = deepAccess(bid, `mediaTypes.video.plcmt`);
if (plcmt) {
bidObject.plcmt = plcmt;
Expand Down Expand Up @@ -398,7 +412,8 @@ function generateGeneralParams(generalObject, bidderRequest) {
dnt: (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0,
device_type: getDeviceType(navigator.userAgent),
ua: navigator.userAgent,
session_id: getBidIdParameter('bidderRequestId', generalObject),
is_wrapper: !!generalBidParams.isWrapper,
session_id: generalBidParams.sessionId || getBidIdParameter('bidderRequestId', generalObject),
tmax: timeout
}

Expand Down Expand Up @@ -441,7 +456,7 @@ function generateGeneralParams(generalObject, bidderRequest) {

if (bidderRequest && bidderRequest.refererInfo) {
generalParams.referrer = deepAccess(bidderRequest, 'refererInfo.ref');
generalParams.page_url = deepAccess(bidderRequest, 'refererInfo.page') || window.location.href
generalParams.page_url = deepAccess(bidderRequest, 'refererInfo.page') || deepAccess(window, 'location.href');
}

return generalParams
Expand Down
41 changes: 36 additions & 5 deletions test/spec/modules/minutemediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,32 @@ describe('minutemediaAdapter', function () {
bidderCode: 'minutemedia',
}
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;
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bids[0].placementId).to.equal(placementId);
});

it('sends bid request to ENDPOINT via POST', function () {
it('sends the plcmt to ENDPOINT via POST', function () {
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.url).to.equal(ENDPOINT);
expect(request.method).to.equal('POST');
expect(request.data.bids[0].plcmt).to.equal(1);
});

it('sends the plcmt to ENDPOINT via POST', function () {
it('sends the is_wrapper parameter to ENDPOINT via POST', function() {
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bids[0].plcmt).to.equal(1);
expect(request.data.params).to.be.an('object');
expect(request.data.params).to.have.property('is_wrapper');
expect(request.data.params.is_wrapper).to.equal(false);
});

it('sends bid request to ENDPOINT via POST', function () {
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.url).to.equal(ENDPOINT);
expect(request.method).to.equal('POST');
});

it('sends bid request to TEST ENDPOINT via POST', function () {
Expand All @@ -133,6 +143,27 @@ describe('minutemediaAdapter', 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

0 comments on commit 255c323

Please sign in to comment.