Skip to content

Commit

Permalink
Merge pull request #15 from guardian/kc-upstream
Browse files Browse the repository at this point in the history
Merge from upstream
  • Loading branch information
kelvin-chappell authored Mar 8, 2018
2 parents 756fd64 + 34f1549 commit 62f00f7
Show file tree
Hide file tree
Showing 55 changed files with 5,410 additions and 554 deletions.
18 changes: 18 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 14
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- bug
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
1 change: 1 addition & 0 deletions PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ For modules and core platform updates, the initial reviewer should request an ad
- All user-sync (aka pixel) activity must be registered via the provided functions
- Adapters may not use the $$PREBID_GLOBAL$$ variable
- All adapters must support the creation of multiple concurrent instances. This means, for example, that adapters cannot rely on mutable global variables.
- Adapters may not globally override or default the standard ad server targeting values: hb_adid, hb_bidder, hb_pb, hb_deal, or hb_size, hb_source, hb_format.

## Ticket Coordinator

Expand Down
14 changes: 7 additions & 7 deletions build/dist/prebid.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { config } = require('../src/config');

const BIDDER_CODE = '33across';
const END_POINT = 'https://ssc.33across.com/api/v1/hb';
const SYNC_ENDPOINT = 'https://de.tynt.com/deb/v2?m=xch';
const SYNC_ENDPOINT = 'https://de.tynt.com/deb/v2?m=xch&rt=html';

// All this assumes that only one bid is ever returned by ttx
function _createBidResponse(response) {
Expand Down
17 changes: 14 additions & 3 deletions modules/adformBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict';

import {registerBidder} from 'src/adapters/bidderFactory';
import { BANNER, VIDEO } from 'src/mediaTypes';

const BIDDER_CODE = 'adform';
export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [ BANNER, VIDEO ],
isBidRequestValid: function (bid) {
return !!(bid.params.mid);
},
Expand Down Expand Up @@ -64,14 +66,20 @@ export const spec = {
}
},
interpretResponse: function (serverResponse, bidRequest) {
var bidObject, response, bid;
const VALID_RESPONSES = {
banner: 1,
vast_content: 1,
vast_url: 1
};
var bidObject, response, bid, type;
var bidRespones = [];
var bids = bidRequest.bids;
var responses = serverResponse.body;
for (var i = 0; i < responses.length; i++) {
response = responses[i];
type = response.response === 'banner' ? BANNER : VIDEO;
bid = bids[i];
if (response.response === 'banner' && verifySize(response, bid.sizes)) {
if (VALID_RESPONSES[response.response] && (verifySize(response, bid.sizes) || type === VIDEO)) {
bidObject = {
requestId: bid.bidId,
cpm: response.win_bid,
Expand All @@ -84,7 +92,10 @@ export const spec = {
ttl: 360,
ad: response.banner,
bidderCode: bidRequest.bidder,
transactionId: bid.transactionId
transactionId: bid.transactionId,
vastUrl: response.vast_url,
vastXml: response.vast_content,
mediaType: type
};
bidRespones.push(bidObject);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/adformBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Maintainer: Scope.FL.Scripts@adform.com
# Description

Module that connects to Adform demand sources to fetch bids.
Banner formats are supported.
Banner and video formats are supported.

# Test Parameters
```
Expand Down
3 changes: 2 additions & 1 deletion modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as utils from 'src/utils';
import { format } from 'src/url';
// import { config } from 'src/config';
import { registerBidder } from 'src/adapters/bidderFactory';
import find from 'core-js/library/fn/array/find';

const VERSION = '1.0';
const BIDDER_CODE = 'adyoulike';
Expand Down Expand Up @@ -77,7 +78,7 @@ export const spec = {

/* Get hostname from bids */
function getHostname(bidderRequest) {
let dcHostname = bidderRequest.find(bid => bid.params.DC);
let dcHostname = find(bidderRequest, bid => bid.params.DC);
if (dcHostname) {
return ('-' + dcHostname.params.DC);
}
Expand Down
29 changes: 27 additions & 2 deletions modules/audienceNetworkBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const isBidRequestValid = bid =>
typeof bid.params.placementId === 'string' &&
bid.params.placementId.length > 0 &&
Array.isArray(bid.sizes) && bid.sizes.length > 0 &&
(isVideo(bid.params.format) || bid.sizes.map(flattenSize).some(isValidSize));
(isFullWidth(bid.params.format) ? bid.sizes.map(flattenSize).every(size => size === '300x250') : true) &&
(isValidNonSizedFormat(bid.params.format) || bid.sizes.map(flattenSize).some(isValidSize));

/**
* Flattens a 2-element [W, H] array as a 'WxH' string,
Expand All @@ -51,13 +52,37 @@ const expandSize = size => size.split('x').map(Number);
*/
const isValidSize = size => includes(['300x250', '320x50'], size);

/**
* Is this a valid, non-sized format?
* @param {String} size
* @returns {Boolean}
*/
const isValidNonSizedFormat = format => includes(['video', 'native'], format);

/**
* Is this a valid size and format?
* @param {String} size
* @returns {Boolean}
*/
const isValidSizeAndFormat = (size, format) =>
(isFullWidth(format) && flattenSize(size) === '300x250') ||
isValidNonSizedFormat(format) ||
isValidSize(flattenSize(size));

/**
* Is this a video format?
* @param {String} format
* @returns {Boolean}
*/
const isVideo = format => format === 'video';

/**
* Is this a fullwidth format?
* @param {String} format
* @returns {Boolean}
*/
const isFullWidth = format => format === 'fullwidth';

/**
* Which SDK version should be used for this format?
* @param {String} format
Expand Down Expand Up @@ -120,7 +145,7 @@ const buildRequests = bids => {

bids.forEach(bid => bid.sizes
.map(flattenSize)
.filter(size => isValidSize(size) || isVideo(bid.params.format))
.filter(size => isValidSizeAndFormat(size, bid.params.format))
.slice(0, 1)
.forEach(size => {
placementids.push(bid.params.placementId);
Expand Down
Loading

0 comments on commit 62f00f7

Please sign in to comment.