Skip to content

Commit

Permalink
Lunamedia ad size parameter update (#5490)
Browse files Browse the repository at this point in the history
* Update Bidder Code

* LunaMedia Adapater

LunaMedia Adapater

* Updated LunamediaBidAdapter.md test params and valid pub code for testing

* adding it to resolve conflict in locally repo

* Accept size parameters

Accept size parameters

* Based on browserstack testing result

Adding a new line.

home/circleci/Prebid.js/modules/lunamediaBidAdapter.js

  401:22  error  Newline required at end of file but not found  eol-last

✖ 1 problem (1 error, 0 warnings)

  1 error, 0 warnings potentially fixable with the `--fix` option.

* updated as per review

updated as per review

Co-authored-by: Chandra Prakash <chandra.prakash@advangelists.com>
  • Loading branch information
trchandraprakash and Chandra Prakash committed Jul 20, 2020
1 parent 884e7fc commit c56a03f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
28 changes: 22 additions & 6 deletions modules/lunamediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -44,6 +44,7 @@ export const spec = {

bannerBids.forEach(bid => {
pubid = getBannerBidParam(bid, 'pubid');

requests.push({
method: 'POST',
url: BANNER_ENDPOINT + pubid,
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -379,5 +396,4 @@ function createBannerRequestData(bid, bidderRequest) {

return o;
}

registerBidder(spec);
6 changes: 4 additions & 2 deletions modules/lunamediaBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ var displayAdUnit = [
bidder: 'lunamedia',
params: {
pubid: '121ab139faf7ac67428a23f1d0a9a71b',
placement: 1234
placement: 1234,
size: "320x50"
}
}]
}];
Expand All @@ -52,7 +53,8 @@ var videoAdUnit = {
bidder: 'lunamedia',
params: {
pubid: '121ab139faf7ac67428a23f1d0a9a71b',
placement: 1234,
placement: 1234,
size: "320x480",
video: {
id: 123,
skip: 1,
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/lunamediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit c56a03f

Please sign in to comment.