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

PulsePoint: remove usage of deprecated utils method / prep for 3.0 #4257

Merged
merged 34 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2fba6a2
ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)
anand-venkatraman Oct 14, 2016
ca17acb
Merge remote-tracking branch 'upstream/master'
anand-venkatraman Oct 25, 2016
5da43c3
Adding bidRequest to bidFactory.createBid method as per https://githu…
anand-venkatraman Oct 25, 2016
cf41114
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Nov 8, 2016
62756a9
ET-1765: Adding support for additional params in PulsePoint adapter (#2)
anand-venkatraman Nov 9, 2016
f8fabb7
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Dec 8, 2016
b9af15c
ET-1850: Fixing https://github.com/prebid/Prebid.js/issues/866
anand-venkatraman Dec 8, 2016
6523c25
Merge pull request #3 from pulsepointinc/ET-1850
anand-venkatraman Dec 8, 2016
b5eeb7f
Minor fix
anand-venkatraman Dec 8, 2016
0f33ef5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Mar 1, 2017
b5dbd34
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jun 27, 2017
d6fcd11
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jul 17, 2017
fce16ad
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Aug 15, 2017
9833867
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Sep 22, 2017
70924c5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Oct 12, 2017
41f4aca
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Nov 13, 2017
aae98a7
Adding mandatory parameters to Bid
anand-venkatraman Nov 13, 2017
6d546ed
Merge from upstream
anand-venkatraman Nov 27, 2017
a04a18f
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Mar 7, 2018
467e9e3
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Apr 20, 2018
af1b3db
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Apr 30, 2018
a438b67
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 4, 2018
e2fa8c3
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 21, 2018
6db9eb4
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 22, 2018
92a6034
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 29, 2018
2195429
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jan 21, 2019
c0e32d5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 18, 2019
832976a
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 30, 2019
b780838
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jun 19, 2019
07ccd3d
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jul 10, 2019
8b5815f
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jul 15, 2019
3d0dcc2
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Oct 1, 2019
ef4053a
Removing usage of deprecated utils method
anand-venkatraman Oct 1, 2019
fb84522
minor refactor
anand-venkatraman Oct 2, 2019
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: 6 additions & 6 deletions modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const spec = {
const request = {
id: bidRequests[0].bidderRequestId,
imp: bidRequests.map(slot => impression(slot)),
site: site(bidRequests),
site: site(bidRequests, bidderRequest),
app: app(bidRequests),
device: device(),
bcat: bidRequests[0].params.bcat,
Expand Down Expand Up @@ -100,7 +100,7 @@ function bidResponseAvailable(request, response) {
idToBidMap[bid.impid] = bid;
}));
}
if (request.bidderRequest) {
if (request.bidderRequest && request.bidderRequest.bids) {
request.bidderRequest.bids.forEach(bid => {
idToSlotConfig[bid.bidId] = bid;
});
Expand Down Expand Up @@ -307,16 +307,16 @@ function dataAsset(id, params, type, defaultLen) {
/**
* Produces an OpenRTB site object.
*/
function site(bidderRequest) {
const pubId = bidderRequest && bidderRequest.length > 0 ? bidderRequest[0].params.cp : '0';
const appParams = bidderRequest[0].params.app;
function site(bidRequests, bidderRequest) {
const pubId = bidRequests && bidRequests.length > 0 ? bidRequests[0].params.cp : '0';
const appParams = bidRequests[0].params.app;
if (!appParams) {
return {
publisher: {
id: pubId.toString(),
},
ref: referrer(),
page: utils.getTopWindowLocation().href,
page: bidderRequest && bidderRequest.refererInfo ? bidderRequest.refererInfo.referer : '',
}
}
return null;
Expand Down
42 changes: 24 additions & 18 deletions test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint dot-notation:0, quote-props:0 */
import {expect} from 'chai';
import {spec} from 'modules/pulsepointBidAdapter';
import {deepClone, getTopWindowLocation} from 'src/utils';
import {deepClone} from 'src/utils';

describe('PulsePoint Adapter Tests', function () {
const slotConfigs = [{
Expand Down Expand Up @@ -138,9 +138,14 @@ describe('PulsePoint Adapter Tests', function () {
}
}
}];
const bidderRequest = {
refererInfo: {
referer: 'https://publisher.com/home'
}
};

it('Verify build request', function () {
const request = spec.buildRequests(slotConfigs);
const request = spec.buildRequests(slotConfigs, bidderRequest);
expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
expect(request.method).to.equal('POST');
const ortbRequest = request.data;
Expand All @@ -149,7 +154,7 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.site.publisher).to.not.equal(null);
expect(ortbRequest.site.publisher.id).to.equal('p10000');
expect(ortbRequest.site.ref).to.equal(window.top.document.referrer);
expect(ortbRequest.site.page).to.equal(getTopWindowLocation().href);
expect(ortbRequest.site.page).to.equal('https://publisher.com/home');
expect(ortbRequest.imp).to.have.lengthOf(2);
// device object
expect(ortbRequest.device).to.not.equal(null);
Expand All @@ -167,7 +172,7 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify parse response', function () {
const request = spec.buildRequests(slotConfigs);
const request = spec.buildRequests(slotConfigs, bidderRequest);
const ortbRequest = request.data;
const ortbResponse = {
seatbid: [{
Expand Down Expand Up @@ -196,7 +201,7 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify use ttl in ext', function () {
const request = spec.buildRequests(slotConfigs);
const request = spec.buildRequests(slotConfigs, bidderRequest);
const ortbRequest = request.data;
const ortbResponse = {
seatbid: [{
Expand All @@ -222,13 +227,13 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify full passback', function () {
const request = spec.buildRequests(slotConfigs);
const request = spec.buildRequests(slotConfigs, bidderRequest);
const bids = spec.interpretResponse({ body: null }, request)
expect(bids).to.have.lengthOf(0);
});

it('Verify Native request', function () {
const request = spec.buildRequests(nativeSlotConfig);
const request = spec.buildRequests(nativeSlotConfig, bidderRequest);
expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
expect(request.method).to.equal('POST');
const ortbRequest = request.data;
Expand Down Expand Up @@ -266,7 +271,7 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify Native response', function () {
const request = spec.buildRequests(nativeSlotConfig);
const request = spec.buildRequests(nativeSlotConfig, bidderRequest);
expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
expect(request.method).to.equal('POST');
const ortbRequest = request.data;
Expand Down Expand Up @@ -355,7 +360,7 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify app requests', function () {
const request = spec.buildRequests(appSlotConfig);
const request = spec.buildRequests(appSlotConfig, bidderRequest);
const ortbRequest = request.data;
// site object
expect(ortbRequest.site).to.equal(null);
Expand All @@ -368,13 +373,13 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify GDPR', function () {
const bidderRequest = {
const bidderRequestGdpr = {
gdprConsent: {
gdprApplies: true,
consentString: 'serialized_gpdr_data'
}
};
const request = spec.buildRequests(slotConfigs, bidderRequest);
const request = spec.buildRequests(slotConfigs, Object.assign({}, bidderRequest, bidderRequestGdpr));
expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
expect(request.method).to.equal('POST');
const ortbRequest = request.data;
Expand All @@ -389,7 +394,7 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify Video request', function () {
const request = spec.buildRequests(videoSlotConfig);
const request = spec.buildRequests(videoSlotConfig, bidderRequest);
expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
expect(request.method).to.equal('POST');
const ortbRequest = request.data;
Expand All @@ -409,7 +414,7 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify Video response', function () {
const request = spec.buildRequests(videoSlotConfig);
const request = spec.buildRequests(videoSlotConfig, bidderRequest);
expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
expect(request.method).to.equal('POST');
const ortbRequest = request.data;
Expand All @@ -433,7 +438,7 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify extra parameters', function () {
let request = spec.buildRequests(additionalParamsConfig);
let request = spec.buildRequests(additionalParamsConfig, bidderRequest);
let ortbRequest = request.data;
expect(ortbRequest).to.not.equal(null);
expect(ortbRequest.imp).to.have.lengthOf(1);
Expand All @@ -448,15 +453,15 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.imp[0].ext.prebid.extra_key4).to.eql([1, 2, 3]);
expect(Object.keys(ortbRequest.imp[0].ext.prebid)).to.eql(['extra_key1', 'extra_key2', 'extra_key3', 'extra_key4']);
// attempting with a configuration with no unknown params.
request = spec.buildRequests(outstreamSlotConfig);
request = spec.buildRequests(outstreamSlotConfig, bidderRequest);
ortbRequest = request.data;
expect(ortbRequest).to.not.equal(null);
expect(ortbRequest.imp).to.have.lengthOf(1);
expect(ortbRequest.imp[0].ext).to.equal(null);
});

it('Verify ortb parameters', function () {
const request = spec.buildRequests(ortbParamsSlotConfig);
const request = spec.buildRequests(ortbParamsSlotConfig, bidderRequest);
const ortbRequest = request.data;
expect(ortbRequest).to.not.equal(null);
expect(ortbRequest.bcat).to.eql(['IAB-1', 'IAB-20']);
Expand All @@ -472,7 +477,8 @@ describe('PulsePoint Adapter Tests', function () {
});

it('Verify outstream renderer', function () {
const request = spec.buildRequests(outstreamSlotConfig, {bids: [outstreamSlotConfig[0]]});
const bidderRequestOutstream = Object.assign({}, bidderRequest, {bids: [outstreamSlotConfig[0]]});
const request = spec.buildRequests(outstreamSlotConfig, bidderRequestOutstream);
const ortbRequest = request.data;
expect(ortbRequest).to.not.be.null;
expect(ortbRequest.imp[0]).to.not.be.null;
Expand Down Expand Up @@ -521,7 +527,7 @@ describe('PulsePoint Adapter Tests', function () {
}
}
};
const request = spec.buildRequests(bidRequests);
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request).to.be.not.null;
const ortbRequest = request.data;
expect(request.data).to.be.not.null;
Expand Down