Skip to content

Commit

Permalink
Revert "Automatad Bid Adapter: Support multiple bids in response (pre…
Browse files Browse the repository at this point in the history
…bid#5699)"

This reverts commit fa354dc.
  • Loading branch information
BrightMountainMediaInc authored Sep 14, 2020
1 parent 01b65b0 commit 057d25f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 66 deletions.
30 changes: 14 additions & 16 deletions modules/automatadBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,20 @@ export const spec = {
const bidResponses = []
const response = (serverResponse || {}).body

if (response && response.seatbid && response.seatbid[0].bid && response.seatbid[0].bid.length) {
response.seatbid.forEach(bidObj => {
bidObj.bid.forEach(bid => {
bidResponses.push({
requestId: bid.impid,
cpm: bid.price,
ad: bid.adm,
adDomain: bid.adomain[0],
currency: DEFAULT_CURRENCY,
ttl: DEFAULT_BID_TTL,
creativeId: bid.crid,
width: bid.w,
height: bid.h,
netRevenue: DEFAULT_NET_REVENUE,
nurl: bid.nurl,
})
if (response && response.seatbid && response.seatbid.length === 1 && response.seatbid[0].bid && response.seatbid[0].bid.length) {
response.seatbid[0].bid.forEach(bid => {
bidResponses.push({
requestId: bid.impid,
cpm: bid.price,
ad: bid.adm,
adDomain: bid.adomain[0],
currency: DEFAULT_CURRENCY,
ttl: DEFAULT_BID_TTL,
creativeId: bid.crid,
width: bid.w,
height: bid.h,
netRevenue: DEFAULT_NET_REVENUE,
nurl: bid.nurl,
})
})
} else {
Expand Down
50 changes: 0 additions & 50 deletions test/spec/modules/automatadBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,56 +113,6 @@ describe('automatadBidAdapter', function () {
expect(result).to.be.an('array').that.is.not.empty
})

it('should interpret multiple bids in seatbid', function () {
let multipleBidResponse = [{
'body': {
'id': 'abc-321',
'seatbid': [
{
'bid': [
{
'adm': '<!-- creative code -->',
'adomain': [
'someAdDomain'
],
'crid': 123,
'h': 600,
'id': 'bid1',
'impid': 'imp1',
'nurl': 'https://example/win',
'price': 0.5,
'w': 300
}
]
}, {
'bid': [
{
'adm': '<!-- creative code -->',
'adomain': [
'someAdDomain'
],
'crid': 321,
'h': 600,
'id': 'bid1',
'impid': 'imp2',
'nurl': 'https://example/win',
'price': 0.5,
'w': 300
}
]
}
]
}
}]
let result = spec.interpretResponse(multipleBidResponse[0]).map(bid => {
const {requestId} = bid;
return [ requestId ];
});

assert.equal(result.length, 2);
assert.deepEqual(result, [[ 'imp1' ], [ 'imp2' ]]);
})

it('handles empty bid response', function () {
let response = {
body: ''
Expand Down

0 comments on commit 057d25f

Please sign in to comment.