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] New Yieldone adapter #194

Open
wants to merge 3 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
2 changes: 2 additions & 0 deletions yieldone/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 1.0.0
- Initial version, implemented the bidder
71 changes: 71 additions & 0 deletions yieldone/DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Yieldone
## General Compatibility
|Feature| |
|---|---|
| Consent | No |
| Native Ad Support | No |
| SafeFrame Support | No |
| PMP Support | Yes |

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

## Adapter Information
| Info | |
|---|---|
| Partner Id | YieldoneHtb |
| Ad Server Responds in (Cents, Dollars, etc) | |
| Bid Type (Gross / Net) | Net |
| GAM Key (Open Market) | ix_yie_cpm |
| GAM Key (Private Market) | ix_yie_cpm |
| Ad Server URLs | http(s)://y.one.impact-ad.jp/h_bid |
| Slot Mapping Sytle (Size / Multiple Sizes / Slot) | Slot |
| Request Architecture (MRA / SRA) | MRA |

## 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 |
|---|---|---|---|
| placementId | Yes | string | The placement ID |
### Example
```javascript
{
"placementId": "36891"
}
```
5 changes: 5 additions & 0 deletions yieldone/yieldone-htb-exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//? if (FEATURES.GPT_LINE_ITEMS) {
shellInterface.YieldoneHtb = {
render: SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'YieldoneHtb')
};
//? }
112 changes: 112 additions & 0 deletions yieldone/yieldone-htb-system-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
'use strict';

function getPartnerId() {
return 'YieldoneHtb';
}

function getStatsId() {
return 'YIE';
}

function getCallbackType() {
return 'NONE';
}

function getArchitecture() {
return 'MRA';
}

function getConfig() {
return {
xSlots: {
1: {
placementId: '36891',
sizes: [[300, 250], [350, 600]]
}
}
};
}

function getBidRequestRegex() {
return {
method: 'GET',
urlRegex: /.*y\.one\.impact-ad\.jp\/h_bid\?.*/
};
}

function validateBidRequest(request) {
// Check query string parameters.

expect(request.query.v).toBe('hb2');
expect(request.query.p).toBe('36891');
expect(request.query.r).toBeDefined();
expect(request.query.uc).toBeDefined();
expect(request.query.tid).toBeDefined();
expect(request.query.cb).toBeDefined();
expect(request.query.uid).toBeDefined();
expect(request.query.t).toBe('i');
expect(request.query.sz).toBe('300x250,350x600');
}

function getValidResponse(request, creative) {
var uid = request.query.uid;
var adm = creative || '<div>test content</div>';
var response = {
cpm: 0.002,
adTag: adm,
height: 250,
width: 300,
uid: uid
};

return JSON.stringify(response);
}

function validateTargeting(targetingMap) {
expect(targetingMap).toEqual(jasmine.objectContaining({
ix_yie_cpm: jasmine.arrayContaining(['300x250_200']),
ix_yie_id: jasmine.arrayContaining([jasmine.any(String)])
}));
}

function getPassResponse() {
return '{}';
}

function getValidResponseWithDeal(request, creative) {
var uid = request.query.uid;
var adm = creative || '<div>test content</div>';
var response = {
cpm: 0.003,
adTag: adm,
height: 250,
width: 300,
uid: uid,
dealId: 11
};

return JSON.stringify(response);
}

function validateTargetingWithDeal(targetingMap) {
expect(targetingMap).toEqual(jasmine.objectContaining({
ix_yie_cpm: jasmine.arrayContaining(['300x250_300']),
ix_yie_dealid: jasmine.arrayContaining(['300x250_11']),
ix_yie_id: jasmine.arrayContaining([jasmine.any(String)])
}));
}

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

////////////////////////////////////////////////////////////////////////////////
// Dependencies ////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

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

////////////////////////////////////////////////////////////////////////////////
// Main ////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

/* =============================================================================
* STEP 0 | Config Validation
* -----------------------------------------------------------------------------
* This file contains the necessary validation for the partner configuration.
* This validation will be performed on the partner specific configuration object
* that is passed into the wrapper. The wrapper uses an outside library called
* schema-insepctor to perform the validation. Information about it can be found here:
* https://atinux.fr/schema-inspector/.
*/
function partnerValidator(configs) {
var result = Inspector.validate({
type: 'object',
properties: {
xSlots: {
type: 'object',
properties: {
'*': {
type: 'object',
properties: {
placementId: {
type: 'string',
minLength: 1
}
}
}
}
}
}
}, configs);

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

return null;
}

module.exports = partnerValidator;
Loading