Skip to content

Commit fc6cc67

Browse files
sa1omonAlex
authored and
Alex
committed
Gamoshi: Remove and update some bid response properties (prebid#3806)
* Add support for multi-format ad units. Add favoredMediaType property to params. * Add tests for gdpr consent. * Add adId to outbids * Modify media type resolving * Refactor multi-format ad units handler. * Remove adId from bid response * Add DEFAULT_TTL const for ttl property * Modify TTL const to 360
1 parent 9002e69 commit fc6cc67

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

modules/gamoshiBidAdapter.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const ENDPOINTS = {
1111
'gambid': 'https://rtb.gamoshi.io',
1212
};
1313

14+
const DEFAULT_TTL = 360;
15+
1416
export const helper = {
1517
getTopFrame: function () {
1618
try {
@@ -114,7 +116,7 @@ export const spec = {
114116

115117
if (mediaTypes && mediaTypes.video) {
116118
if (!hasFavoredMediaType || params.favoredMediaType === VIDEO) {
117-
const playerSize = mediaTypes.video.playerSize;
119+
const playerSize = mediaTypes.video.playerSize || sizes;
118120
const videoImp = Object.assign({}, imp, {
119121
video: {
120122
w: playerSize ? playerSize[0][0] : 300,
@@ -150,18 +152,15 @@ export const spec = {
150152

151153
bids.forEach(bid => {
152154
const outBid = {
153-
adId: bidRequest.bidRequest.adUnitCode,
154155
requestId: bidRequest.bidRequest.bidId,
155156
cpm: bid.price,
156157
width: bid.w,
157158
height: bid.h,
158-
ttl: 60 * 10,
159-
creativeId: bid.crid,
159+
ttl: DEFAULT_TTL,
160+
creativeId: bid.crid || bid.adid,
160161
netRevenue: true,
161162
currency: bid.cur || response.cur,
162-
adUnitCode: bidRequest.bidRequest.adUnitCode,
163163
mediaType: helper.getMediaType(bid)
164-
165164
};
166165

167166
if (utils.deepAccess(bidRequest.bidRequest, 'mediaTypes.' + outBid.mediaType)) {

test/spec/modules/gamoshiBidAdapter_spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ describe('GamoshiAdapter', function () {
329329
]
330330
};
331331

332+
const TTL = 360;
333+
332334
it('returns an empty array on missing response', function () {
333335
let response;
334336

@@ -345,13 +347,12 @@ describe('GamoshiAdapter', function () {
345347
const response = spec.interpretResponse({body: rtbResponse}, {bidRequest: bannerBidRequest});
346348
expect(Array.isArray(response)).to.equal(true);
347349
expect(response.length).to.equal(1);
348-
349350
const ad0 = response[0];
350351
expect(ad0.requestId).to.equal(bannerBidRequest.bidId);
351352
expect(ad0.cpm).to.equal(rtbResponse.seatbid[1].bid[0].price);
352353
expect(ad0.width).to.equal(rtbResponse.seatbid[1].bid[0].w);
353354
expect(ad0.height).to.equal(rtbResponse.seatbid[1].bid[0].h);
354-
expect(ad0.ttl).to.equal(60 * 10);
355+
expect(ad0.ttl).to.equal(TTL);
355356
expect(ad0.creativeId).to.equal(rtbResponse.seatbid[1].bid[0].crid);
356357
expect(ad0.netRevenue).to.equal(true);
357358
expect(ad0.currency).to.equal(rtbResponse.seatbid[1].bid[0].cur || rtbResponse.cur || 'USD');
@@ -364,13 +365,12 @@ describe('GamoshiAdapter', function () {
364365
const response = spec.interpretResponse({body: rtbResponse}, {bidRequest: videoBidRequest});
365366
expect(Array.isArray(response)).to.equal(true);
366367
expect(response.length).to.equal(1);
367-
368368
const ad0 = response[0];
369369
expect(ad0.requestId).to.equal(videoBidRequest.bidId);
370370
expect(ad0.cpm).to.equal(rtbResponse.seatbid[0].bid[0].price);
371371
expect(ad0.width).to.equal(rtbResponse.seatbid[0].bid[0].w);
372372
expect(ad0.height).to.equal(rtbResponse.seatbid[0].bid[0].h);
373-
expect(ad0.ttl).to.equal(60 * 10);
373+
expect(ad0.ttl).to.equal(TTL);
374374
expect(ad0.creativeId).to.equal(rtbResponse.seatbid[0].bid[0].crid);
375375
expect(ad0.netRevenue).to.equal(true);
376376
expect(ad0.currency).to.equal(rtbResponse.seatbid[0].bid[0].cur || rtbResponse.cur || 'USD');

0 commit comments

Comments
 (0)