Skip to content

Commit

Permalink
Colossus adapter changes for Prebid 3.0 (prebid#4476)
Browse files Browse the repository at this point in the history
* add video&native traffic colossus ssp

* Native obj validation

* Native obj validation #2

* Added size field in requests

* fixed test

* fix merge conflicts

* move to 3.0

* move to 3.0

* fix IE11 new URL issue

* fix IE11 new URL issue

* fix IE11 new URL issue

* https for 3.0

* add https test
  • Loading branch information
Bill Newman authored and afewcc committed Dec 10, 2019
1 parent 72aa251 commit c29a884
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
21 changes: 12 additions & 9 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes';
import * as utils from '../src/utils';

const BIDDER_CODE = 'colossusssp';
const URL = '//colossusssp.com/?c=o&m=multi';
const URL_SYNC = '//colossusssp.com/?c=o&m=cookie';
const G_URL = 'https://colossusssp.com/?c=o&m=multi';
const G_URL_SYNC = 'https://colossusssp.com/?c=o&m=cookie';

function isBidResponseValid(bid) {
if (!bid.requestId || !bid.cpm || !bid.creativeId || !bid.ttl || !bid.currency) {
Expand Down Expand Up @@ -42,15 +42,16 @@ export const spec = {
* @param {BidRequest[]} validBidRequests A non-empty list of valid bid requests that should be sent to the Server.
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: (validBidRequests) => {
buildRequests: (validBidRequests, bidderRequest) => {
let winTop = window;
let location;
try {
window.top.location.toString();
location = new URL(bidderRequest.refererInfo.referer)
winTop = window.top;
} catch (e) {
location = winTop.location;
utils.logMessage(e);
};
let location = utils.getTopWindowLocation();
let placements = [];
let request = {
'deviceWidth': winTop.screen.width,
Expand All @@ -61,19 +62,21 @@ export const spec = {
'page': location.pathname,
'placements': placements
};

for (let i = 0; i < validBidRequests.length; i++) {
let bid = validBidRequests[i];
let traff = bid.params.traffic || BANNER
let placement = {
placementId: bid.params.placement_id,
bidId: bid.bidId,
sizes: bid.sizes,
traffic: bid.params.traffic || BANNER
sizes: bid.mediaTypes[traff].sizes,
traffic: traff
};
placements.push(placement);
}
return {
method: 'POST',
url: URL,
url: G_URL,
data: request
};
},
Expand Down Expand Up @@ -103,7 +106,7 @@ export const spec = {
getUserSyncs: () => {
return [{
type: 'image',
url: URL_SYNC
url: G_URL_SYNC
}];
}
};
Expand Down
6 changes: 5 additions & 1 deletion modules/colossussspBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ Module that connects to Colossus SSP demand sources
```
var adUnits = [{
code: 'placementid_0',
sizes: [[300, 250]],
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]]
}
},
bids: [{
bidder: 'colossusssp',
params: {
Expand Down
10 changes: 7 additions & 3 deletions test/spec/modules/colossussspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ describe('ColossussspAdapter', function () {
},
placementCode: 'placementid_0',
auctionId: '74f78609-a92d-4cf1-869f-1b244bbfb5d2',
sizes: [[300, 250]],
mediaTypes: {
banner: {
sizes: [[300, 250]]
}
},
transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62'
};

Expand All @@ -37,7 +41,7 @@ describe('ColossussspAdapter', function () {
expect(serverRequest.method).to.equal('POST');
});
it('Returns valid URL', function () {
expect(serverRequest.url).to.equal('//colossusssp.com/?c=o&m=multi');
expect(serverRequest.url).to.equal('https://colossusssp.com/?c=o&m=multi');
});
it('Returns valid data if array of bids is valid', function () {
let data = serverRequest.data;
Expand Down Expand Up @@ -112,7 +116,7 @@ describe('ColossussspAdapter', function () {
expect(userSync[0].type).to.exist;
expect(userSync[0].url).to.exist;
expect(userSync[0].type).to.be.equal('image');
expect(userSync[0].url).to.be.equal('//colossusssp.com/?c=o&m=cookie');
expect(userSync[0].url).to.be.equal('https://colossusssp.com/?c=o&m=cookie');
});
});
});

0 comments on commit c29a884

Please sign in to comment.