Skip to content

Commit

Permalink
Between: multisizes support added (prebid#5019)
Browse files Browse the repository at this point in the history
* Between: multisizes support added

* rollback package-lock.json

Co-authored-by: Ignat Khaylov <khaylov@betweenx.com>
  • Loading branch information
2 people authored and iggyfisk committed Jun 22, 2020
1 parent 70a7a0d commit 4afa7fe
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
7 changes: 3 additions & 4 deletions modules/betweenBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';

import { getAdUnitSizes, parseSizesInput } from '../src/utils.js';
const BIDDER_CODE = 'between';

export const spec = {
Expand All @@ -13,7 +13,7 @@ export const spec = {
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: function(bid) {
return !!(bid.params.w && bid.params.h && bid.params.s);
return Boolean(bid.params.s);
},
/**
* Make a server request from the list of BidRequests.
Expand All @@ -27,13 +27,12 @@ export const spec = {

validBidRequests.forEach(i => {
let params = {
sizes: parseSizesInput(getAdUnitSizes(i)),
jst: 'hb',
ord: Math.random() * 10000000000000000,
tz: getTz(),
fl: getFl(),
rr: getRr(),
w: i.params.w,
h: i.params.h,
s: i.params.s,
bidid: i.bidId,
transactionid: i.transactionId,
Expand Down
23 changes: 14 additions & 9 deletions modules/betweenBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ About us : http://betweendigital.com
```javascript
var adUnits = [
{
code: 'test-div',
code: 'ad_slot',
mediaTypes: {
banner: {
sizes: [[970, 250], [240, 400], [728, 90]]
}
},
bids: [
{
bidder: "between",
params: {
w: 200,
h: 400,
s: 111
s: 122938
}
}
]
Expand All @@ -45,14 +48,16 @@ Where:
var PREBID_TIMEOUT = 700;
var adUnits = [{
code: 'example',
sizes: [[300, 250], [200,400]],
code: 'example',
mediaTypes: {
banner: {
sizes: [[970, 250], [240, 400], [728, 90]]
}
},
bids: [{
bidder: 'between',
params: {
w: 240,
h: 400,
s: 8
s: 809832
}
}]
Expand Down
20 changes: 20 additions & 0 deletions test/spec/modules/betweenBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,24 @@ describe('betweenBidAdapterTests', function () {
expect(syncs).to.be.an('array').that.to.have.lengthOf(1);
expect(syncs[0]).to.deep.equal({type: 'iframe', url: 'https://ads.betweendigital.com/sspmatch-iframe'});
});

it('check sizes', function() {
let bidRequestData = [{
bidId: 'bid1234',
bidder: 'between',
mediaTypes: {
banner: {
sizes: [[970, 250], [240, 400], [728, 90]]
}
},
params: {
s: 1112,
},
}];

let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;

expect(req_data.sizes).to.deep.equal(['970x250', '240x400', '728x90']);
});
});

0 comments on commit 4afa7fe

Please sign in to comment.