Skip to content

Commit

Permalink
Boldwin Bid Adapter: added endpointId param (prebid#8798)
Browse files Browse the repository at this point in the history
* new boldwin bid adapter

* fix

* Restarting ci / circleci

* changes

* fixed conflicts

* added endpointId param

* kick off CircleCI tests

Co-authored-by: Aiholkin <artem.iholkin@smartyads.com>
Co-authored-by: Vladislav Isaiko <vladis@smartyads.com>
Co-authored-by: Mykhailo Yaremchuk <m.yaremchuk@smartyads.com>
Co-authored-by: Chris Huie <phoenixtechnerd@gmail.com>
  • Loading branch information
5 people authored and JacobKlein26 committed Feb 8, 2023
1 parent edaa499 commit d5247e6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
15 changes: 12 additions & 3 deletions modules/boldwinBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const spec = {
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

isBidRequestValid: (bid) => {
return Boolean(bid.bidId && bid.params && bid.params.placementId);
return Boolean(bid.bidId && bid.params && (bid.params.placementId || bid.params.endpointId));
},

buildRequests: (validBidRequests = [], bidderRequest) => {
Expand Down Expand Up @@ -85,7 +85,7 @@ export const spec = {

for (let i = 0; i < len; i++) {
let bid = validBidRequests[i];
const { mediaTypes } = bid;
const { mediaTypes, params } = bid;
const placement = {};
let sizes;
if (mediaTypes) {
Expand Down Expand Up @@ -114,9 +114,18 @@ export const spec = {
placement.native = mediaTypes[NATIVE];
}
}

const { placementId, endpointId } = params;
if (placementId) {
placement.placementId = placementId;
placement.type = 'publisher';
} else if (endpointId) {
placement.endpointId = endpointId;
placement.type = 'network';
}

placements.push({
...placement,
placementId: bid.params.placementId,
bidId: bid.bidId,
sizes: sizes || [],
wPlayer: sizes ? sizes[0] : 0,
Expand Down
17 changes: 17 additions & 0 deletions modules/boldwinBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,22 @@ Module that connects to boldwin demand sources
}
]
}
// Will return static test banner
{
code: 'endpointId_0',
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
},
bids: [
{
bidder: 'boldwin',
params: {
endpointId: 'testBanner',
}
}
]
},
];
```
3 changes: 2 additions & 1 deletion test/spec/modules/boldwinBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ describe('BoldwinBidAdapter', function () {
expect(data.gdpr).to.not.exist;
expect(data.ccpa).to.not.exist;
let placement = data['placements'][0];
expect(placement).to.have.keys('placementId', 'bidId', 'adFormat', 'sizes', 'hPlayer', 'wPlayer', 'schain', 'bidFloor');
expect(placement).to.have.keys('placementId', 'bidId', 'adFormat', 'sizes', 'hPlayer', 'wPlayer', 'schain', 'bidFloor', 'type');
expect(placement.placementId).to.equal('testBanner');
expect(placement.bidId).to.equal('23fhj33i987f');
expect(placement.adFormat).to.equal(BANNER);
expect(placement.schain).to.be.an('object');
expect(placement.type).to.exist.and.to.equal('publisher');
});

it('Returns valid data for mediatype video', function () {
Expand Down

0 comments on commit d5247e6

Please sign in to comment.