Skip to content

Commit

Permalink
MinuteMediaPlus Bid Adapter: Add support for passing metaData object …
Browse files Browse the repository at this point in the history
…from server response. (#9816)
  • Loading branch information
saar120 authored Apr 17, 2023
1 parent 4534d4b commit ec76c84
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
17 changes: 13 additions & 4 deletions modules/minutemediaplusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function interpretResponse(serverResponse, request) {

try {
results.forEach(result => {
const {creativeId, ad, price, exp, width, height, currency, advertiserDomains, mediaType = BANNER} = result;
const {creativeId, ad, price, exp, width, height, currency, metaData, advertiserDomains, mediaType = BANNER} = result;
if (!ad || !price) {
return;
}
Expand All @@ -218,11 +218,20 @@ function interpretResponse(serverResponse, request) {
currency: currency || CURRENCY,
netRevenue: true,
ttl: exp || TTL_SECONDS,
meta: {
advertiserDomains: advertiserDomains || []
}
};

if (metaData) {
Object.assign(response, {
meta: metaData
})
} else {
Object.assign(response, {
meta: {
advertiserDomains: advertiserDomains || []
}
})
}

if (mediaType === BANNER) {
Object.assign(response, {
ad: ad,
Expand Down
13 changes: 13 additions & 0 deletions test/spec/modules/minutemediaplusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,19 @@ describe('MinuteMediaPlus Bid Adapter', function () {
});
});

it('should get meta from response metaData', function () {
const serverResponse = utils.deepClone(SERVER_RESPONSE);
serverResponse.body.results[0].metaData = {
advertiserDomains: ['minutemedia-prebid.com'],
agencyName: 'Agency Name',
};
const responses = adapter.interpretResponse(serverResponse, REQUEST);
expect(responses[0].meta).to.deep.equal({
advertiserDomains: ['minutemedia-prebid.com'],
agencyName: 'Agency Name'
});
});

it('should return an array of interpreted video responses', function () {
const responses = adapter.interpretResponse(VIDEO_SERVER_RESPONSE, REQUEST);
expect(responses).to.have.length(1);
Expand Down

0 comments on commit ec76c84

Please sign in to comment.