Skip to content

Commit

Permalink
Ogury Adapter add device density in bid request (#9796)
Browse files Browse the repository at this point in the history
  • Loading branch information
jogury authored Apr 12, 2023
1 parent f26f7db commit f6dd267
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
5 changes: 3 additions & 2 deletions modules/oguryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_TIMEOUT = 1000;
const BID_HOST = 'https://mweb-hb.presage.io/api/header-bidding-request';
const TIMEOUT_MONITORING_HOST = 'https://ms-ads-monitoring-events.presage.io';
const MS_COOKIE_SYNC_DOMAIN = 'https://ms-cookie-sync.presage.io';
const ADAPTER_VERSION = '1.4.0';
const ADAPTER_VERSION = '1.4.1';

function getClientWidth() {
const documentElementClientWidth = window.top.document.documentElement.clientWidth
Expand Down Expand Up @@ -90,7 +90,8 @@ function buildRequests(validBidRequests, bidderRequest) {
},
device: {
w: getClientWidth(),
h: getClientHeight()
h: getClientHeight(),
pxratio: window.devicePixelRatio
}
};

Expand Down
23 changes: 19 additions & 4 deletions test/spec/modules/oguryBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ describe('OguryBidAdapter', function () {
const stubbedWidth = 200
const stubbedHeight = 600
const stubbedCurrentTime = 1234567890
const stubbedDevicePixelRatio = 1
const stubbedWidthMethod = sinon.stub(window.top.document.documentElement, 'clientWidth').get(function() {
return stubbedWidth;
});
Expand All @@ -255,6 +256,10 @@ describe('OguryBidAdapter', function () {
return stubbedCurrentTime;
});

const stubbedDevicePixelMethod = sinon.stub(window, 'devicePixelRatio').get(function() {
return stubbedDevicePixelRatio;
});

const defaultTimeout = 1000;
const expectedRequestObject = {
id: bidRequests[0].auctionId,
Expand Down Expand Up @@ -305,18 +310,20 @@ describe('OguryBidAdapter', function () {
},
ext: {
prebidversion: '$prebid.version$',
adapterversion: '1.4.0'
adapterversion: '1.4.1'
},
device: {
w: stubbedWidth,
h: stubbedHeight
h: stubbedHeight,
pxratio: stubbedDevicePixelRatio,
}
};

after(function() {
stubbedWidthMethod.restore();
stubbedHeightMethod.restore();
stubbedCurrentTimeMethod.restore();
stubbedDevicePixelMethod.restore();
});

it('sends bid request to ENDPOINT via POST', function () {
Expand All @@ -338,6 +345,14 @@ describe('OguryBidAdapter', function () {
stubbedTimelineMethod.restore();
});

it('send device pixel ratio in bid request', function() {
const validBidRequests = utils.deepClone(bidRequests)

const request = spec.buildRequests(validBidRequests, bidderRequest);
expect(request.data).to.deep.equal(expectedRequestObject);
expect(request.data.device.pxratio).to.be.a('number');
})

it('bid request object should be conform', function () {
const validBidRequests = utils.deepClone(bidRequests)

Expand Down Expand Up @@ -697,7 +712,7 @@ describe('OguryBidAdapter', function () {
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[0].adomain
},
nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl,
adapterVersion: '1.4.0',
adapterVersion: '1.4.1',
prebidVersion: '$prebid.version$'
}, {
requestId: openRtbBidResponse.body.seatbid[0].bid[1].impid,
Expand All @@ -714,7 +729,7 @@ describe('OguryBidAdapter', function () {
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[1].adomain
},
nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl,
adapterVersion: '1.4.0',
adapterVersion: '1.4.1',
prebidVersion: '$prebid.version$'
}]

Expand Down

0 comments on commit f6dd267

Please sign in to comment.