diff --git a/modules/adbutlerBidAdapter.js b/modules/adbutlerBidAdapter.js index 44a2ef49f51e..6f8ce2783b29 100644 --- a/modules/adbutlerBidAdapter.js +++ b/modules/adbutlerBidAdapter.js @@ -9,6 +9,7 @@ const BIDDER_CODE = 'adbutler'; export const spec = { code: BIDDER_CODE, pageID: Math.floor(Math.random() * 10e6), + aliases: ['divreach'], isBidRequestValid: function (bid) { return !!(bid.params.accountID && bid.params.zoneID); @@ -98,7 +99,7 @@ export const spec = { }); if (isCorrectCPM && isCorrectSize) { bidResponse.requestId = bidObj.bidId; - bidResponse.bidderCode = spec.code; + bidResponse.bidderCode = bidObj.bidder; bidResponse.creativeId = serverResponse.placement_id; bidResponse.cpm = CPM; bidResponse.width = width; diff --git a/modules/divreachBidAdapter.js b/modules/divreachBidAdapter.js deleted file mode 100644 index e597e32f4be9..000000000000 --- a/modules/divreachBidAdapter.js +++ /dev/null @@ -1,74 +0,0 @@ -import * as utils from 'src/utils'; -import {registerBidder} from 'src/adapters/bidderFactory'; - -const BIDDER_CODE = 'divreach'; -const ENDPOINT_URL = '//ads.divreach.com/prebid.1.0.aspx'; -export const spec = { - code: BIDDER_CODE, - aliases: [], - supportedMediaTypes: ['banner', 'video'], - /** - * Determines whether or not the given bid request is valid. - * - * @param {BidRequest} bid The bid params to validate. - * @return boolean True if this is a valid bid, and false otherwise. - */ - isBidRequestValid: function (bid) { - return !!bid.params.zone; - }, - /** - * Make a server request from the list of BidRequests. - * - * @param {bidderRequest} - bidderRequest.bids[] is an array of AdUnits and bids - * @return ServerRequest Info describing the request to the server. - */ - buildRequests: function (bidderRequest) { - const payload = { - imps: [], - referrer: encodeURIComponent(utils.getTopWindowUrl()), - }; - bidderRequest.forEach((bid) => { - if (bid.bidder === BIDDER_CODE) { - payload.imps.push(bid); - } - }); - const payloadString = JSON.stringify(payload); - return { - method: 'GET', - url: ENDPOINT_URL, - data: `data=${payloadString}`, - }; - }, - /** - * Unpack the response from the server into a list of bids. - * - * @param {*} serverResponse A successful response from the server. - * @return {Bid[]} An array of bids which were nested inside the server. - */ - interpretResponse: function (serverResponse, bidRequest) { - const bidResponses = []; - // loop through serverResponses { - try { - serverResponse = serverResponse.body; - serverResponse.forEach((bidResponse) => { - const bidResp = { - requestId: bidResponse.bidId, - cpm: bidResponse.cpm, - width: bidResponse.width, - height: bidResponse.height, - ad: bidResponse.ad, - ttl: bidResponse.ttl, - creativeId: bidResponse.creativeId, - netRevenue: bidResponse.netRevenue, - currency: bidResponse.currency, - vastUrl: bidResponse.vastUrl, - }; - bidResponses.push(bidResp); - }); - } catch (e) { - utils.logError(e); - } - return bidResponses; - } -}; -registerBidder(spec); diff --git a/modules/divreachBidAdapter.md b/modules/divreachBidAdapter.md index da2ebee97cf0..643845782b8b 100644 --- a/modules/divreachBidAdapter.md +++ b/modules/divreachBidAdapter.md @@ -7,7 +7,6 @@ Maintainer: Zeke@divreach.com # Description Connects to DivReach demand source to fetch bids. -Banner and Video formats are supported. Please use ```divreach``` as the bidder code. # Test Parameters @@ -15,35 +14,14 @@ Please use ```divreach``` as the bidder code. var adUnits = [ { code: 'desktop-banner-ad-div', - sizes: [[300, 250]], // a display size + sizes: [[300, 250]], bids: [ { bidder: "divreach", params: { - zone: '261eae83-0508-4e1a-8c9b-19561fa9279e' - } - } - ] - },{ - code: 'mobile-banner-ad-div', - sizes: [[300, 50]], // a mobile size - bids: [ - { - bidder: "divreach", - params: { - zone: '561e26ea-1999-4fb6-ad0b-9d72929e545e' - } - } - ] - },{ - code: 'video-ad', - sizes: [[300, 50]], - mediaType: 'video', - bids: [ - { - bidder: "divreach", - params: { - zone: 'e784ecbe-720f-46f7-8388-aff8c2c4ed86' + accountID: '167283', + zoneID: '335105', + domain: 'ad.divreach.com', } } ] diff --git a/test/spec/modules/divreachBidAdapter_spec.js b/test/spec/modules/divreachBidAdapter_spec.js deleted file mode 100644 index f874a206a871..000000000000 --- a/test/spec/modules/divreachBidAdapter_spec.js +++ /dev/null @@ -1,117 +0,0 @@ -import {expect} from 'chai'; -import {spec} from 'modules/divreachBidAdapter'; -import {newBidder} from 'src/adapters/bidderFactory'; - -const BIDDER_CODE = 'divreach'; -const ENDPOINT_URL = '//ads.divreach.com/prebid.1.0.aspx'; -const ZONE_ID = '2eb6bd58-865c-47ce-af7f-a918108c3fd2'; - -describe('DivReachAdapter', function () { - const adapter = newBidder(spec); - - describe('inherited functions', function () { - it('exists and is a function', function () { - expect(adapter.callBids).to.be.exist.and.to.be.a('function'); - }); - }); - - describe('isBidRequestValid', function () { - let bid = { - 'bidder': BIDDER_CODE, - 'params': { - 'zone': ZONE_ID - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[300, 250], [300, 600]], - 'bidId': '30b31c1838de1e', - 'bidderRequestId': '22edbae2733bf6', - 'auctionId': '1d1a030790a475', - }; - - it('should return true when required params found', function () { - expect(spec.isBidRequestValid(bid)).to.equal(true); - }); - - it('should return false when required params are not passed', function () { - let bid = Object.assign({}, bid); - delete bid.params; - bid.params = { - 'placementId': 0 - }; - expect(spec.isBidRequestValid(bid)).to.equal(false); - }); - }); - - describe('buildRequests', function () { - let bidRequests = [ - { - 'bidder': BIDDER_CODE, - 'params': { - 'zone': ZONE_ID - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[300, 250], [300, 600]], - 'bidId': '30b31c1838de1e', - 'bidderRequestId': '22edbae2733bf6', - 'auctionId': '1d1a030790a475', - } - ]; - - it('should add referrer and imp to be equal bidRequest', function () { - const request = spec.buildRequests(bidRequests); - const payload = JSON.parse(request.data.substr(5)); - expect(payload.referrer).to.not.be.undefined; - expect(payload.imps[0]).to.deep.equal(bidRequests[0]); - }); - - it('sends bid request to ENDPOINT via GET', function () { - const request = spec.buildRequests(bidRequests); - expect(request.url).to.equal(ENDPOINT_URL); - expect(request.method).to.equal('GET'); - }); - }); - - describe('interpretResponse', function () { - let response = { - body: [{ - 'currency': 'USD', - 'cpm': 6.210000, - 'ad': '
ad
', - 'width': 300, - 'height': 600, - 'creativeId': 'ccca3e5e-0c54-4761-9667-771322fbdffc', - 'ttl': 360, - 'netRevenue': false, - 'bidId': '5e4e763b6bc60b' - }] - }; - - it('should get correct bid response', function () { - const body = response.body; - let expectedResponse = [ - { - 'requestId': body[0].bidId, - 'cpm': body[0].cpm, - 'creativeId': body[0].creativeId, - 'width': body[0].width, - 'height': body[0].height, - 'ad': body[0].ad, - 'vastUrl': undefined, - 'currency': body[0].currency, - 'netRevenue': body[0].netRevenue, - 'ttl': body[0].ttl, - } - ]; - - let result = spec.interpretResponse(response); - expect(result[0]).to.deep.equal(expectedResponse[0]); - }); - - it('handles nobid responses', function () { - let response = []; - - let result = spec.interpretResponse(response); - expect(result.length).to.equal(0); - }); - }); -});