Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Between: multisizes support added #5019

Merged
merged 3 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']);
});
});