diff --git a/modules/lunamediaBidAdapter.js b/modules/lunamediaBidAdapter.js index 83be806af17..b309ef42240 100755 --- a/modules/lunamediaBidAdapter.js +++ b/modules/lunamediaBidAdapter.js @@ -8,8 +8,8 @@ import includes from 'core-js-pure/features/array/includes.js'; const ADAPTER_VERSION = '1.0'; const BIDDER_CODE = 'lunamedia'; -export const VIDEO_ENDPOINT = 'https://api.lunamedia.io/xp/get?pubid=';// 0cf8d6d643e13d86a5b6374148a4afac'; -export const BANNER_ENDPOINT = 'https://api.lunamedia.io/xp/get?pubid=';// 0cf8d6d643e13d86a5b6374148a4afac'; +export const VIDEO_ENDPOINT = 'https://nep.advangelists.com/xp/get?pubid=';// https://api.lunamedia.io/xp/get?pubid=0cf8d6d643e13d86a5b6374148a4afac'; +export const BANNER_ENDPOINT = 'https://nep.advangelists.com/xp/get?pubid=';// 0cf8d6d643e13d86a5b6374148a4afac'; export const OUTSTREAM_SRC = 'https://player-cdn.beachfrontmedia.com/playerapi/loader/outstream.js'; export const VIDEO_TARGETING = ['mimes', 'playbackmethod', 'maxduration', 'skip']; export const DEFAULT_MIMES = ['video/mp4', 'application/javascript']; @@ -44,6 +44,7 @@ export const spec = { bannerBids.forEach(bid => { pubid = getBannerBidParam(bid, 'pubid'); + requests.push({ method: 'POST', url: BANNER_ENDPOINT + pubid, @@ -210,8 +211,16 @@ function createVideoRequestData(bid, bidderRequest) { let topLocation = getTopWindowLocation(bidderRequest); let topReferrer = getTopWindowReferrer(); - let sizes = getVideoSizes(bid); - let firstSize = getFirstSize(sizes); + // if size is explicitly given via adapter params + let paramSize = getVideoBidParam(bid, 'size'); + let sizes = []; + + if (typeof paramSize !== 'undefined' && paramSize != '') { + sizes = parseSizes(paramSize); + } else { + sizes = getVideoSizes(bid); + } + const firstSize = getFirstSize(sizes); let video = getVideoTargetingParams(bid); const o = { @@ -301,7 +310,15 @@ function createBannerRequestData(bid, bidderRequest) { let topLocation = getTopWindowLocation(bidderRequest); let topReferrer = getTopWindowReferrer(); - let sizes = getBannerSizes(bid); + // if size is explicitly given via adapter params + + let paramSize = getBannerBidParam(bid, 'size'); + let sizes = []; + if (typeof paramSize !== 'undefined' && paramSize != '') { + sizes = parseSizes(paramSize); + } else { + sizes = getBannerSizes(bid); + } const o = { 'device': { @@ -379,5 +396,4 @@ function createBannerRequestData(bid, bidderRequest) { return o; } - registerBidder(spec); diff --git a/modules/lunamediaBidAdapter.md b/modules/lunamediaBidAdapter.md index d0314d0fa41..ff5cc86c462 100755 --- a/modules/lunamediaBidAdapter.md +++ b/modules/lunamediaBidAdapter.md @@ -29,7 +29,8 @@ var displayAdUnit = [ bidder: 'lunamedia', params: { pubid: '121ab139faf7ac67428a23f1d0a9a71b', - placement: 1234 + placement: 1234, + size: "320x50" } }] }]; @@ -52,7 +53,8 @@ var videoAdUnit = { bidder: 'lunamedia', params: { pubid: '121ab139faf7ac67428a23f1d0a9a71b', - placement: 1234, + placement: 1234, + size: "320x480", video: { id: 123, skip: 1, diff --git a/test/spec/modules/lunamediaBidAdapter_spec.js b/test/spec/modules/lunamediaBidAdapter_spec.js index fc8648bf8a0..c0809071419 100755 --- a/test/spec/modules/lunamediaBidAdapter_spec.js +++ b/test/spec/modules/lunamediaBidAdapter_spec.js @@ -7,9 +7,9 @@ describe('lunamediaBidAdapter', function () { let bidRequestsVid; beforeEach(function () { - bidRequests = [{'bidder': 'lunamedia', 'params': {'pubid': '0cf8d6d643e13d86a5b6374148a4afac', 'floor': 0.5, 'placement': 1234}, 'crumbs': {'pubcid': '979fde13-c71e-4ac2-98b7-28c90f99b449'}, 'mediaTypes': {'banner': {'sizes': [[300, 250]]}}, 'adUnitCode': 'div-gpt-ad-1460505748561-0', 'transactionId': 'f72931e6-2b0e-4e37-a2bc-1ea912141f81', 'sizes': [[300, 250]], 'bidId': '2aa73f571eaf29', 'bidderRequestId': '1bac84515a7af3', 'auctionId': '5dbc60fa-1aa1-41ce-9092-e6bbd4d478f7', 'src': 'client', 'bidRequestsCount': 1, 'pageurl': 'http://google.com'}]; + bidRequests = [{'bidder': 'lunamedia', 'params': {'pubid': '0cf8d6d643e13d86a5b6374148a4afac', 'floor': 0.5, 'placement': 1234, size: '320x250'}, 'crumbs': {'pubcid': '979fde13-c71e-4ac2-98b7-28c90f99b449'}, 'mediaTypes': {'banner': {'sizes': [[300, 250]]}}, 'adUnitCode': 'div-gpt-ad-1460505748561-0', 'transactionId': 'f72931e6-2b0e-4e37-a2bc-1ea912141f81', 'sizes': [[300, 250]], 'bidId': '2aa73f571eaf29', 'bidderRequestId': '1bac84515a7af3', 'auctionId': '5dbc60fa-1aa1-41ce-9092-e6bbd4d478f7', 'src': 'client', 'bidRequestsCount': 1, 'pageurl': 'http://google.com'}]; - bidRequestsVid = [{'bidder': 'lunamedia', 'params': {'pubid': '8537f00948fc37cc03c5f0f88e198a76', 'floor': 1.0, 'placement': 1234, 'video': {'id': 123, 'skip': 1, 'mimes': ['video/mp4', 'application/javascript'], 'playbackmethod': [2, 6], 'maxduration': 30}}, 'crumbs': {'pubcid': '979fde13-c71e-4ac2-98b7-28c90f99b449'}, 'mediaTypes': {'video': {'playerSize': [[320, 480]], 'context': 'instream'}}, 'adUnitCode': 'video1', 'transactionId': '8b060952-93f7-4863-af44-bb8796b97c42', 'sizes': [], 'bidId': '25c6ab92aa0e81', 'bidderRequestId': '1d420b73a013fc', 'auctionId': '9a69741c-34fb-474c-83e1-cfa003aaee17', 'src': 'client', 'bidRequestsCount': 1, 'pageurl': 'http://google.com'}]; + bidRequestsVid = [{'bidder': 'lunamedia', 'params': {'pubid': '8537f00948fc37cc03c5f0f88e198a76', 'floor': 1.0, 'placement': 1234, size: '320x480', 'video': {'id': 123, 'skip': 1, 'mimes': ['video/mp4', 'application/javascript'], 'playbackmethod': [2, 6], 'maxduration': 30}}, 'crumbs': {'pubcid': '979fde13-c71e-4ac2-98b7-28c90f99b449'}, 'mediaTypes': {'video': {'playerSize': [[320, 480]], 'context': 'instream'}}, 'adUnitCode': 'video1', 'transactionId': '8b060952-93f7-4863-af44-bb8796b97c42', 'sizes': [], 'bidId': '25c6ab92aa0e81', 'bidderRequestId': '1d420b73a013fc', 'auctionId': '9a69741c-34fb-474c-83e1-cfa003aaee17', 'src': 'client', 'bidRequestsCount': 1, 'pageurl': 'http://google.com'}]; }); describe('spec.isBidRequestValid', function () {