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

AdOcean adapter: GDPR support #2988

Merged
merged 20 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added ttl, netRevenue nad creativeId. merged with upstream
  • Loading branch information
jdrobiecki committed Oct 25, 2017
commit 9711ee211ed0d709b324a61241e47cef2bf7ba11
12 changes: 5 additions & 7 deletions modules/adoceanBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ function interpretResponse(placementResponse, bidRequest, bids) {

const bid = {
ad: adCode,
bidderCode: BIDDER_CODE,
cpm: parseFloat(placementResponse.price),
currency: placementResponse.currency,
height: parseInt(placementResponse.height, 10),
requestId: bidRequest.bidIdMap[placementResponse.id],
width: parseInt(placementResponse.width, 10),
netRevenue: false,
ttl: parseInt(placementResponse.ttl),
creativeId: placementResponse.crid
};

bids.push(bid);
Expand Down Expand Up @@ -87,17 +89,13 @@ export const spec = {
interpretResponse: function(serverResponse, bidRequest) {
let bids = [];

if (utils.isArray(serverResponse)) {
utils._each(serverResponse, function(placementResponse) {
if (utils.isArray(serverResponse.body)) {
utils._each(serverResponse.body, function(placementResponse) {
interpretResponse(placementResponse, bidRequest, bids);
});
}

return bids;
},

getUserSyncs: function(syncOptions) {
// empty
}
};
registerBidder(spec);
49 changes: 30 additions & 19 deletions test/spec/modules/adoceanBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, use } from 'chai';
import { expect } from 'chai';
import { spec } from 'modules/adoceanBidAdapter';
import { newBidder } from 'src/adapters/bidderFactory';

Expand Down Expand Up @@ -77,19 +77,26 @@ describe('AdoceanAdapter', () => {
})

describe('interpretResponse', () => {
const response = [
{
'id': 'adoceanmyaozpniqismex',
'price': '0.019000',
'winurl': '',
'statsUrl': '',
'code': '%3C!--%20Creative%20--%3E',
'currency': 'EUR',
'minFloorPrice': '0.01',
'width': '300',
'height': '250'
const response = {
'body': [
{
'id': 'adoceanmyaozpniqismex',
'price': '0.019000',
'winurl': '',
'statsUrl': '',
'code': '%3C!--%20Creative%20--%3E',
'currency': 'EUR',
'minFloorPrice': '0.01',
'width': '300',
'height': '250',
'crid': '0af345b42983cc4bc0',
'ttl': '300'
}
],
'headers': {
'get': function() {}
}
];
};

const bidRequest = {
'bidder': 'adocean',
Expand All @@ -111,13 +118,15 @@ describe('AdoceanAdapter', () => {
it('should get correct bid response', () => {
const expectedResponse = [
{
'bidderCode': 'adocean',
'requestId': '30b31c1838de1e',
'cpm': 0.019000,
'currency': 'EUR',
'width': 300,
'height': 250,
'ad': '<!-- Creative -->'
'ad': '<!-- Creative -->',
'creativeId': '0af345b42983cc4bc0',
'ttl': 300,
'netRevenue': false
}
];

Expand All @@ -135,10 +144,12 @@ describe('AdoceanAdapter', () => {
});

it('handles nobid responses', () => {
const response = {
'id': 'adoceanmyaolafpjwftbz',
'error': 'true'
};
response.body = [
{
'id': 'adoceanmyaolafpjwftbz',
'error': 'true'
}
];

const result = spec.interpretResponse(response, bidRequest);
expect(result).to.have.lengthOf(0);
Expand Down