Skip to content

Commit

Permalink
EMXDigital Bid Adapter: Add video dimensions in request (#4174)
Browse files Browse the repository at this point in the history
* addressed feedback from #3731 ticket

* removed commented code from emx test spec

* logging removed from spec

* flip h & w values from playerSize for video requests

* adding Outstream mediaType to EMX Digital

* adding device info. update to grab video param. styling changes.

* add video dimensions from playerSize

* fix test for video dimensions
  • Loading branch information
EMXDigital authored and Fawke committed Sep 18, 2019
1 parent 313bdc8 commit ebf4272
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 10 additions & 2 deletions modules/emx_digitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import includes from 'core-js/library/fn/array/includes';
const BIDDER_CODE = 'emx_digital';
const ENDPOINT = 'hb.emxdgt.com';
const RENDERER_URL = '//js.brealtime.com/outstream/1.30.0/bundle.js';
const ADAPTER_VERSION = '1.40.2';
const ADAPTER_VERSION = '1.40.3';
const DEFAULT_CUR = 'USD';

export const emxAdapter = {
Expand Down Expand Up @@ -103,7 +103,15 @@ export const emxAdapter = {
return renderer;
},
buildVideo: (bid) => {
let videoObj = Object.assign(bid.mediaTypes.video, bid.params.video)
let videoObj = Object.assign(bid.mediaTypes.video, bid.params.video);

if (utils.isArray(bid.mediaTypes.video.playerSize[0])) {
videoObj['w'] = bid.mediaTypes.video.playerSize[0][0];
videoObj['h'] = bid.mediaTypes.video.playerSize[0][1];
} else {
videoObj['w'] = bid.mediaTypes.video.playerSize[0];
videoObj['h'] = bid.mediaTypes.video.playerSize[1];
}
return emxAdapter.cleanProtocols(videoObj);
},
parseResponse: (bidResponseAdm) => {
Expand Down
12 changes: 6 additions & 6 deletions test/spec/modules/emx_digitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,31 +300,31 @@ describe('emx_digital Adapter', function () {
bidRequestWithVideo[0].mediaTypes = {
video: {
context: 'instream',
playerSize: [640, 480]
playerSize: [[640, 480]]
},
};
bidRequestWithVideo[0].params.video = {};
let request = spec.buildRequests(bidRequestWithVideo, bidderRequest);
const data = JSON.parse(request.data);
expect(data.imp[0].video).to.exist.and.to.be.a('object');
expect(data.imp[0].video.h).to.equal(bidRequestWithVideo[0].mediaTypes.video.playerSize[0][0]);
expect(data.imp[0].video.w).to.equal(bidRequestWithVideo[0].mediaTypes.video.playerSize[0][1]);
expect(data.imp[0].video.w).to.equal(bidRequestWithVideo[0].mediaTypes.video.playerSize[0][0]);
expect(data.imp[0].video.h).to.equal(bidRequestWithVideo[0].mediaTypes.video.playerSize[0][1]);
});

it('builds correctly formatted request video object for outstream', function () {
let bidRequestWithOutstreamVideo = utils.deepClone(bidderRequest.bids);
bidRequestWithOutstreamVideo[0].mediaTypes = {
video: {
context: 'outstream',
playerSize: [640, 480]
playerSize: [[640, 480]]
},
};
bidRequestWithOutstreamVideo[0].params.video = {};
let request = spec.buildRequests(bidRequestWithOutstreamVideo, bidderRequest);
const data = JSON.parse(request.data);
expect(data.imp[0].video).to.exist.and.to.be.a('object');
expect(data.imp[0].video.h).to.equal(bidRequestWithOutstreamVideo[0].mediaTypes.video.playerSize[0][0]);
expect(data.imp[0].video.w).to.equal(bidRequestWithOutstreamVideo[0].mediaTypes.video.playerSize[0][1]);
expect(data.imp[0].video.w).to.equal(bidRequestWithOutstreamVideo[0].mediaTypes.video.playerSize[0][0]);
expect(data.imp[0].video.h).to.equal(bidRequestWithOutstreamVideo[0].mediaTypes.video.playerSize[0][1]);
});

it('shouldn\'t contain a user obj without GDPR information', function () {
Expand Down

0 comments on commit ebf4272

Please sign in to comment.