-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'prebid:master' into biddoBidAdapter
- Loading branch information
Showing
50 changed files
with
3,270 additions
and
1,989 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import {registerBidder} from '../src/adapters/bidderFactory.js'; | ||
import {BANNER} from '../src/mediaTypes.js'; | ||
|
||
const ADMARU_ENDPOINT = 'https://p1.admaru.net/AdCall'; | ||
const BIDDER_CODE = 'admaru'; | ||
|
||
const DEFAULT_BID_TTL = 360; | ||
|
||
function parseBid(rawBid, currency) { | ||
const bid = {}; | ||
|
||
bid.cpm = rawBid.price; | ||
bid.impid = rawBid.impid; | ||
bid.requestId = rawBid.impid; | ||
bid.netRevenue = true; | ||
bid.dealId = ''; | ||
bid.creativeId = rawBid.crid; | ||
bid.currency = currency; | ||
bid.ad = rawBid.adm; | ||
bid.width = rawBid.w; | ||
bid.height = rawBid.h; | ||
bid.mediaType = BANNER; | ||
bid.ttl = DEFAULT_BID_TTL; | ||
|
||
return bid; | ||
} | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
supportedMediaTypes: [BANNER], | ||
|
||
isBidRequestValid: function (bid) { | ||
return !!(bid && bid.params && bid.params.pub_id && bid.params.adspace_id); | ||
}, | ||
|
||
buildRequests: function (validBidRequests, bidderRequest) { | ||
return validBidRequests.map(bid => { | ||
const payload = { | ||
pub_id: bid.params.pub_id, | ||
adspace_id: bid.params.adspace_id, | ||
bidderRequestId: bid.bidderRequestId, | ||
bidId: bid.bidId | ||
}; | ||
|
||
return { | ||
method: 'GET', | ||
url: ADMARU_ENDPOINT, | ||
data: payload, | ||
} | ||
}) | ||
}, | ||
|
||
interpretResponse: function (serverResponse, bidRequest) { | ||
const bidResponses = []; | ||
let bid = null; | ||
|
||
if (!serverResponse.hasOwnProperty('body') || !serverResponse.body.hasOwnProperty('seatbid')) { | ||
return bidResponses; | ||
} | ||
|
||
const serverBody = serverResponse.body; | ||
const seatbid = serverBody.seatbid; | ||
|
||
for (let i = 0; i < seatbid.length; i++) { | ||
if (!seatbid[i].hasOwnProperty('bid')) { | ||
continue; | ||
} | ||
|
||
const innerBids = seatbid[i].bid; | ||
for (let j = 0; j < innerBids.length; j++) { | ||
bid = parseBid(innerBids[j], serverBody.cur); | ||
|
||
bidResponses.push(bid); | ||
} | ||
} | ||
|
||
return bidResponses; | ||
} | ||
} | ||
|
||
registerBidder(spec); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Overview | ||
|
||
``` | ||
Module Name: Admaru Bidder Adapter | ||
Module Type: Bidder Adapter | ||
Maintainer: support@admaru.com | ||
``` | ||
|
||
# Description | ||
|
||
Module that connects to Admaru demand sources | ||
|
||
# Test Parameters | ||
``` | ||
var adUnits = [ | ||
{ | ||
code: 'test-div', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250]], // a display size | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: "admaru", | ||
params: { | ||
pub_id: '1234', // string - required | ||
adspace_id: '1234' // string - required | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.