Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HTP-0001] ecdrsvc: new adapter certification #222

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added ecdrsvc/CHANGES.md
Empty file.
75 changes: 75 additions & 0 deletions ecdrsvc/DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ecdrsvc
## General Compatibility
|Feature| |
|---|---|
| Consent | |
| Native Ad Support | |
| SafeFrame Support | |
| PMP Support | |

## Browser Compatibility
| Browser | |
|--- |---|
| Chrome | |
| Edge | |
| Firefox | |
| Internet Explorer 9 | |
| Internet Explorer 10 | |
| Internet Explorer 11 | |
| Safari | |
| Mobile Chrome | |
| Mobile Safari | |
| UC Browser | |
| Samsung Internet | |
| Opera | |

## Adapter Information
| Info | |
|---|---|
| Partner Id | EcdrsvcHtb |
| Ad Server Responds in (Cents, Dollars, etc) | |
| Bid Type (Gross / Net) | |
| GAM Key (Open Market) | |
| GAM Key (Private Market) | |
| Ad Server URLs | |
| Slot Mapping Style (Size / Multiple Sizes / Slot) | |
| Request Architecture (MRA / SRA) | |

## Currencies Supported

## Bid Request Information
### Parameters
| Key | Required | Type | Description |
|---|---|---|---|
| | | | |

### Example
```javascript

```

## Bid Response Information
### Bid Example
```javascript

```
### Pass Example
```javascript

```

## Configuration Information
### Configuration Keys
| Key | Required | Type | Description |
|---|---|---|---|
| | | | |
### Example
```javascript

```

## Test Configuration
(Test configuration or methodology that can be used to retrieve & render a test creative from ecdrsvc's platform)
```javascript

```
5 changes: 5 additions & 0 deletions ecdrsvc/ecdrsvc-htb-exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//? if (FEATURES.GPT_LINE_ITEMS) {
shellInterface.EcdrsvcHtb = {
render: SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'EcdrsvcHtb')
};
//? }
99 changes: 99 additions & 0 deletions ecdrsvc/ecdrsvc-htb-system-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
'use strict';

function getPartnerId() {
return 'EcdrsvcHtb';
}

function getCallbackType() {
return 'NONE';
}

function getArchitecture() {
return 'MRA';
}

function getStatsId() {
return 'ECD';
}

function getConfig() {
var config = {
// Partner level parameter
xSlots: {
1: {
// Slot level parameter
ppid: 12345,
sizes: [[300, 250]]
}
}
};

return config;
}

function getBidRequestRegex() {
return {
method: 'POST',
urlRegex: /.*prometheus-ix.ecdrsvc.com\/prometheus\/bid.*/
};
}

function validateBidRequest(request) {
var r = JSON.parse(request.body);
expect(r.site.url).toBeDefined();
expect(r.site.referrer).toBeDefined();
expect(r.site.ppid).toBeDefined();
}

function getValidResponse(request, creative) {
var r = JSON.parse(request.body);
var adm = creative || '<script type="text/javascript" src="https://adsvr.ecdrsvc.com/?6000004"></script>';
var response = {
request_id: r.id,
seat_bid: [
{
impression_id: '0119dfa3a38611ebaef48fa5d96696e6',
bid_price: 2.00,
width: 300,
height: 250,
adomain: ['www.loblaws.ca'],
creative: adm
}
],
deal: ''
};

return JSON.stringify(response);
}

function validateTargeting(targetingMap) {
expect(targetingMap).toEqual(
jasmine.objectContaining({
ix_ecd_cpm: jasmine.arrayWithExactContents(['300x250_200']),
ix_ecd_id: jasmine.arrayWithExactContents([jasmine.any(String)])
})
);
}

function getPassResponse(request) {
var r = JSON.parse(request.body);

return JSON.stringify({
seat_bid: [],
request_id: r.request_id,
deal: ''
});
}

module.exports = {
getPartnerId: getPartnerId,
getCallbackType: getCallbackType,
getArchitecture: getArchitecture,
getStatsId: getStatsId,
getConfig: getConfig,
getBidRequestRegex: getBidRequestRegex,
validateBidRequest: validateBidRequest,
getValidResponse: getValidResponse,
validateTargeting: validateTargeting,
getPassResponse: getPassResponse
};
43 changes: 43 additions & 0 deletions ecdrsvc/ecdrsvc-htb-validator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

var Inspector = require('../../../libs/external/schema-inspector.js');

function partnerValidator(configs) {
var result = Inspector.validate({
type: 'object',
properties: {
xSlots: {
type: 'object',
properties: {
'*': {
type: 'object',
properties: {
ppid: {
type: 'integer'
},
sizes: {
type: 'array',
minLength: 1,
items: {
type: 'array',
exactLength: 2,
items: {
type: 'integer'
}
}
}
}
}
}
}
}
}, configs);

if (!result.valid) {
return result.format();
}

return null;
}

module.exports = partnerValidator;
Loading