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

added feature/getNoBidsForAdUnitCode function #5932

Merged
merged 2 commits into from
Nov 16, 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
12 changes: 12 additions & 0 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ $$PREBID_GLOBAL$$.getNoBids = function () {
return getBids('getNoBids');
};

/**
* This function returns the bids requests involved in an auction but not bid on or the specified adUnitCode
* @param {string} adUnitCode adUnitCode
* @alias module:pbjs.getNoBidsForAdUnitCode
* @return {Object} bidResponse object
*/

$$PREBID_GLOBAL$$.getNoBidsForAdUnitCode = function (adUnitCode) {
const bids = auctionManager.getNoBids().filter(bid => bid.adUnitCode === adUnitCode);
return { bids };
};

/**
* This function returns the bid responses at the given moment.
* @alias module:pbjs.getBidResponses
Expand Down
6 changes: 5 additions & 1 deletion test/spec/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ describe('Publisher API', function () {
assert.isFunction($$PREBID_GLOBAL$$.getBidResponses);
});

it('should have function $$PREBID_GLOBAL$$.getBidResponses', function () {
it('should have function $$PREBID_GLOBAL$$.getNoBids', function () {
assert.isFunction($$PREBID_GLOBAL$$.getNoBids);
});

it('should have function $$PREBID_GLOBAL$$.getNoBidsForAdUnitCode', function () {
assert.isFunction($$PREBID_GLOBAL$$.getNoBidsForAdUnitCode);
});

it('should have function $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode', function () {
assert.isFunction($$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode);
});
Expand Down