@mediamath/terminalone
Advanced tools
Comparing version
@@ -12,3 +12,3 @@ # Contributing | ||
$ cd t1-node/ | ||
$ mocha test | ||
$ npm test | ||
``` | ||
@@ -15,0 +15,0 @@ |
@@ -1,4 +0,5 @@ | ||
var chai = require('chai'); | ||
var chaiAsPromised = require('chai-as-promised'); | ||
var sinonChai = require('sinon-chai'); | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const chai = require('chai'); | ||
const chaiAsPromised = require('chai-as-promised'); | ||
const sinonChai = require('sinon-chai'); | ||
@@ -5,0 +6,0 @@ chai.config.includeStack = true; |
@@ -1,42 +0,33 @@ | ||
"use strict"; | ||
let expect = require('./chai_config').expect; | ||
let t1 = require('../index'); | ||
const expect = require('./chai_config').expect; | ||
const t1 = require('../index'); | ||
require('dotenv').load(); | ||
describe("Get, and edit deals", function () { | ||
describe('Get, and edit deals', () => { | ||
const t1conf = { | ||
user: process.env.T1_API_USERNAME, | ||
password: process.env.T1_API_PASSWORD, | ||
api_key: process.env.T1_API_KEY, | ||
baseUrl: process.env.T1_BASEURL, | ||
}; | ||
const conn = new t1.T1Connection(t1conf); | ||
const testTimestamp = new Date().toISOString(); | ||
let t1conf = { | ||
user: process.env.T1_API_USERNAME, | ||
password: process.env.T1_API_PASSWORD, | ||
api_key: process.env.T1_API_KEY, | ||
client_secret: process.env.T1_SECRET, | ||
apiBaseUrl: process.env.T1_BASEURL, | ||
redirect_uri: process.env.T1_REDIRECTURL, | ||
advertiser_id: parseInt(process.env.T1_ADVERTISER) | ||
// Tests will return 403 if user does not have access to advertiser | ||
}; | ||
let conn = new t1.T1Connection(t1conf); | ||
let testTimestamp = new Date().toISOString(); | ||
let expectedName = "t1-node test deal" + testTimestamp; | ||
let campaignId, strategyId; | ||
describe('#get and update single deal', function getUpdateSingle() { | ||
this.timeout(100000); | ||
const deal = new t1.Entity('deal'); | ||
describe("#get and update single deal", function () { | ||
let deal = new t1.Entity('deal'); | ||
it('should get an existing deal', () => { | ||
const dealPromise = deal.get(process.env.TEST_DEAL_ID, conn); | ||
return expect(dealPromise).to.eventually | ||
.have.property('id', process.env.TEST_DEAL_ID); | ||
}); | ||
it("should get an existing deal", function () { | ||
let dealPromise = deal.get(195324, conn); | ||
return expect(dealPromise).to.eventually | ||
.have.property('id', 195324) | ||
}); | ||
it("should update the name", function () { | ||
let expectedName = "t1-node test deal" + testTimestamp; | ||
deal.name = expectedName; | ||
let dealPromise = deal.save(conn); | ||
return expect(dealPromise).to.eventually | ||
.have.property('name', expectedName); | ||
}); | ||
it('should update the name', () => { | ||
const expectedName = `t1-node test deal${testTimestamp}`; | ||
deal.name = expectedName; | ||
const dealPromise = deal.save(conn); | ||
return expect(dealPromise).to.eventually | ||
.have.property('name', expectedName); | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -1,24 +0,22 @@ | ||
"use strict"; | ||
var EntityMap = require('../entitymap'); | ||
const EntityMap = require('../entitymap'); | ||
// base prototype for targeting - shouldn't be used directly. | ||
var Targeting = function (targetingQueryString, targetingPostString, id) { | ||
this.targetingQueryString = targetingQueryString; | ||
this.targetingPostString = targetingPostString; | ||
this.strategy_id = id; | ||
const Targeting = function Targeting(targetingQueryString, targetingPostString, id) { | ||
this.targetingQueryString = targetingQueryString; | ||
this.targetingPostString = targetingPostString; | ||
this.strategy_id = id; | ||
}; | ||
Targeting.prototype.get = function (strategy_id, connection) { | ||
if (connection) { | ||
var that = this; | ||
var endpoint = EntityMap.getEndpoint("strategy") + "/" + strategy_id + "/" + that.targetingQueryString; | ||
return connection.get(endpoint) | ||
.then(function (body) { | ||
that.strategy_id = strategy_id; | ||
var content = JSON.parse(body); | ||
return that.updateTargeting(content.data, content.meta); | ||
}); | ||
} | ||
Targeting.prototype.get = function get(strategy_id, connection) { | ||
if (connection) { | ||
const that = this; | ||
const endpoint = `${EntityMap.getEndpoint('strategy')}/${strategy_id}/${that.targetingQueryString}`; | ||
return connection.get(endpoint) | ||
.then((body) => { | ||
that.strategy_id = strategy_id; | ||
const content = JSON.parse(body); | ||
return that.updateTargeting(content.data, content.meta); | ||
}); | ||
} | ||
throw new Error('no connection supplied'); | ||
}; | ||
@@ -28,28 +26,28 @@ | ||
// called on successful get/save | ||
Targeting.prototype.updateTargeting = function (data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
Targeting.prototype.updateTargeting = function updateTargeting(data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
console.warn('updateTargeting should be implemented by a derived class'); | ||
return this; | ||
console.warn('updateTargeting should be implemented by a derived class'); | ||
return this; | ||
}; | ||
Targeting.prototype.save = function (connection) { | ||
var that = this; | ||
return that._generateForm() | ||
.then(function (form) { | ||
var endpoint = EntityMap.getEndpoint("strategy") + "/" + | ||
that.strategy_id + "/" + | ||
that.targetingPostString; | ||
Targeting.prototype.save = function save(connection) { | ||
const that = this; | ||
return that.generateForm() | ||
.then((form) => { | ||
const endpoint = `${EntityMap.getEndpoint('strategy')}/${ | ||
that.strategy_id}/${ | ||
that.targetingPostString}`; | ||
return connection.postFormdata(endpoint, form).then(function (body) { | ||
var content = JSON.parse(body); | ||
return that.updateTargeting(content.data, content.meta); | ||
}); | ||
}); | ||
return connection.postFormdata(endpoint, form).then((body) => { | ||
const content = JSON.parse(body); | ||
return that.updateTargeting(content.data, content.meta); | ||
}); | ||
}); | ||
}; | ||
Targeting.prototype._generateForm = function () { | ||
console.error('_generateForm is not implemented!'); | ||
Targeting.prototype.generateForm = function generateFormfunction() { | ||
console.error('generateForm is not implemented!'); | ||
}; | ||
@@ -56,0 +54,0 @@ |
@@ -1,33 +0,33 @@ | ||
"use strict"; | ||
let EntityMap = require('./entitymap'); | ||
let SchemaProcessing = require('./schemaprocessing'); | ||
const EntityMap = require('./entitymap'); | ||
const SchemaProcessing = require('./schemaprocessing'); | ||
const EntityList = require('./entitylist'); | ||
require('dotenv').load(); | ||
let Entity = function (type, connection, id) { | ||
this.entity_type = type; | ||
const Entity = function Entity(type, connection, id) { | ||
this.entity_type = type; | ||
if (id && connection) { | ||
this.get(id, connection); | ||
} | ||
if (id && connection) { | ||
this.get(id, connection); | ||
} | ||
}; | ||
Entity.prototype.get = function (id, connection, userParams) { | ||
if (!connection) { | ||
throw new Error("connection object must be provided"); | ||
} | ||
let that = this; | ||
return SchemaProcessing.getSchema('userparams') | ||
.then(function (schema) { | ||
let verification = SchemaProcessing.validateJson(userParams, schema); | ||
if (verification.length !== 0) { | ||
// you may want to specify a custom error type here, and set the verification | ||
// results as a property of them. | ||
throw new Error(verification); | ||
} | ||
let queryString = connection.buildQueryString(EntityMap.getEndpoint(that.entity_type) + "/" + id, userParams); | ||
return connection.get(queryString); | ||
}).then(function (body) { | ||
let content = JSON.parse(body); | ||
return that.processEntity(content.data, content.meta); | ||
}); | ||
Entity.prototype.get = function get(id, connection, userParams) { | ||
if (!connection) { | ||
throw new Error('connection object must be provided'); | ||
} | ||
const that = this; | ||
return SchemaProcessing.getSchema('userparams') | ||
.then((schema) => { | ||
const verification = SchemaProcessing.validateJson(userParams, schema); | ||
if (verification.length !== 0) { | ||
// you may want to specify a custom error type here, and set the verification | ||
// results as a property of them. | ||
throw new Error(verification); | ||
} | ||
const queryString = connection.buildQueryString(`${EntityMap.getEndpoint(that.entity_type)}/${id}`, userParams); | ||
return connection.get(queryString); | ||
}).then((body) => { | ||
const content = JSON.parse(body); | ||
return that.processEntity(content.data, content.meta); | ||
}); | ||
}; | ||
@@ -37,169 +37,162 @@ | ||
// called on successful save of entity | ||
Entity.prototype.processEntity = function (data, meta) { | ||
for (let property in data) { | ||
if (!data.hasOwnProperty(property) || !data[property]) { | ||
continue; | ||
} | ||
if (data[property].constructor === Array && | ||
data[property][0].hasOwnProperty('entity_type')) { | ||
let EntityList = require('./entitylist'); | ||
data[property] = EntityList.processEntityList(data[property], {}); | ||
} | ||
else if (data[property].constructor === Object && | ||
data[property].hasOwnProperty('entity_type')) { | ||
let related = new Entity(data[property].entity_type); | ||
related.processEntity(data[property], {}); | ||
data[property] = related; | ||
} | ||
Entity.prototype.processEntity = function processEntity(data, meta) { | ||
Object.keys(data).forEach((key) => { | ||
const value = data[key]; | ||
if ( | ||
value && | ||
value.constructor === Array && | ||
Object.prototype.hasOwnProperty.call(value[0], 'entity_type')) { | ||
data[key] = EntityList.processEntityList(value, {}); | ||
} else if ( | ||
value && | ||
value.constructor === Object && | ||
Object.prototype.hasOwnProperty.call(value, 'entity_type')) { | ||
const related = new Entity(value.entity_type); | ||
related.processEntity(value, {}); | ||
data[key] = related; | ||
} | ||
}); | ||
if (meta !== undefined) { | ||
data.meta = meta; | ||
} | ||
if (!meta) { | ||
data.meta = meta; | ||
} | ||
Object.assign(this, data); | ||
return this; | ||
Object.assign(this, data); | ||
return this; | ||
}; | ||
Entity.prototype.save = function (connection) { | ||
let that = this; | ||
return SchemaProcessing.getSchema(that.entity_type) | ||
.then(function (schema) { | ||
let verification = SchemaProcessing.validateJson(that, schema); | ||
if (verification.length !== 0) { | ||
throw new Error(verification); | ||
} | ||
else { | ||
let endpoint = EntityMap.getEndpoint(that.entity_type); | ||
let postFormat = EntityMap.getPostFormat(that.entity_type); | ||
Entity.prototype.save = function save(connection) { | ||
const that = this; | ||
return SchemaProcessing.getSchema(that.entity_type) | ||
.then((schema) => { | ||
const verification = SchemaProcessing.validateJson(that, schema); | ||
if (verification.length !== 0) { | ||
throw new Error(verification); | ||
} else { | ||
let endpoint = EntityMap.getEndpoint(that.entity_type); | ||
const postFormat = EntityMap.getPostFormat(that.entity_type); | ||
if (typeof that.id !== 'undefined') { | ||
endpoint += "/" + that.id; | ||
} | ||
if (postFormat === 'json') { | ||
return that._saveJson(endpoint, connection); | ||
} | ||
else if (postFormat === 'formdata') { | ||
return that._saveFormData(endpoint, connection); | ||
} | ||
} | ||
}); | ||
if (typeof that.id !== 'undefined') { | ||
endpoint += `/${that.id}`; | ||
} | ||
if (postFormat === 'json') { | ||
return that.saveJson(endpoint, connection); | ||
} else if (postFormat === 'formdata') { | ||
return that.saveFormData(endpoint, connection); | ||
} | ||
throw new Error('No postformat defined'); | ||
} | ||
}); | ||
}; | ||
Entity.prototype.getCurrencyValue = function (fieldName, currencyName) { | ||
return _getOrSetCurrencyValue(this, fieldName, currencyName); | ||
Entity.prototype.saveJson = function saveJson(endpoint, connection) { | ||
const data = this.getJsonData(); | ||
const that = this; | ||
return connection.postJson(endpoint, data).then((body) => { | ||
const content = JSON.parse(body); | ||
return that.processEntity(content.data, content.meta); | ||
}); | ||
}; | ||
Entity.prototype.setCurrencyValue = function (fieldName, amount, currencyName) { | ||
return _getOrSetCurrencyValue(this, fieldName, currencyName, amount); | ||
}; | ||
Entity.prototype._saveJson = function (endpoint, connection) { | ||
let data = this._getJsonData(); | ||
let that = this; | ||
return connection.postJson(endpoint, data).then(function (body) { | ||
let content = JSON.parse(body); | ||
Entity.prototype.saveFormData = function saveFormData(endpoint, connection) { | ||
const that = this; | ||
return that.getPostFormData() | ||
.then((form) => { | ||
let entityEndpoint = EntityMap.getEndpoint(that.entity_type); | ||
if (typeof that.id !== 'undefined') { | ||
entityEndpoint += `/${that.id}`; | ||
} | ||
return connection.postFormdata(entityEndpoint, form).then((body) => { | ||
const content = JSON.parse(body); | ||
return that.processEntity(content.data, content.meta); | ||
}); | ||
}); | ||
}; | ||
Entity.prototype._saveFormData = function (endpoint, connection) { | ||
let that = this; | ||
return that._getPostFormData() | ||
.then(function (form) { | ||
let endpoint = EntityMap.getEndpoint(that.entity_type); | ||
if (typeof that.id !== 'undefined') { | ||
endpoint += "/" + that.id; | ||
} | ||
return connection.postFormdata(endpoint, form).then(function (body) { | ||
let content = JSON.parse(body); | ||
return that.processEntity(content.data, content.meta); | ||
}); | ||
}); | ||
Entity.prototype.getJsonData = function getJsonData() { | ||
const data = JSON.parse(JSON.stringify(this)); | ||
// remove any null properties; the API doesn't support them. | ||
Object.keys(this).forEach((property) => { | ||
if (Object.prototype.hasOwnProperty.call(this, property) && !this[property]) { | ||
delete data[property]; | ||
} | ||
}); | ||
return JSON.stringify(data); | ||
}; | ||
Entity.prototype._getJsonData = function () { | ||
Entity.prototype.getPostFormData = function getPostFormData() { | ||
const that = this; | ||
return SchemaProcessing.getSchema(that.entity_type) | ||
.then((schema) => { | ||
const schemaAllOf = schema.allOf; | ||
let data = JSON.parse(JSON.stringify(this)); | ||
//remove any null properties; the API doesn't support them. | ||
for (let property in this) { | ||
if (this.hasOwnProperty(property) && !this[property]) { | ||
delete data[property]; | ||
function encodeForPost(key, value) { | ||
if (typeof value === 'boolean') { | ||
return Number(value); | ||
} else if (typeof value === 'function') { | ||
return undefined; | ||
} | ||
} | ||
return JSON.stringify(data); | ||
}; | ||
// flatten currency elements | ||
if (Array.isArray(value) && | ||
Object.prototype.hasOwnProperty.call(value[0], 'currency_code')) { | ||
return that.getCurrencyValue(key); | ||
} | ||
return value; | ||
} | ||
Entity.prototype._getPostFormData = function () { | ||
let that = this; | ||
return SchemaProcessing.getSchema(that.entity_type) | ||
.then(function (schema) { | ||
let schemaAllOf = schema.allOf; | ||
let encodeForPost = function (key, value) { | ||
if (typeof value === "boolean") { | ||
return Number(value); | ||
} | ||
else if (typeof value === "function") { | ||
return undefined; | ||
} | ||
return value; | ||
}; | ||
const form = JSON.parse(JSON.stringify(that, encodeForPost)); | ||
schemaAllOf.forEach((schemaComponent) => { | ||
Object.keys(schemaComponent.properties).forEach((key) => { | ||
if (schemaComponent.properties[key].readonly) { | ||
delete form[key]; | ||
} | ||
}); | ||
}); | ||
let form = JSON.parse(JSON.stringify(that, encodeForPost)); | ||
schemaAllOf.map(function (schema) { | ||
Object.keys(schema.properties).forEach(function (key) { | ||
if (schema.properties[key].readonly) { | ||
delete form[key]; | ||
} | ||
}); | ||
}); | ||
//flatten the currency elements | ||
for (let property in form) { | ||
if (!form.hasOwnProperty(property)) { | ||
continue; | ||
} | ||
if (form[property].constructor === Array && | ||
form[property][0].hasOwnProperty('currency_code')) { | ||
form[property] = that.getCurrencyValue(property); | ||
} | ||
} | ||
return form; | ||
}); | ||
return form; | ||
}); | ||
}; | ||
function _getOrSetCurrencyValue(obj, fieldName, currencyName, setAmount) { | ||
if (!currencyName) { | ||
currencyName = obj.currency_code || (process.env.CURRENCY_CODE || 'USD'); | ||
function getOrSetCurrencyValue(obj, fieldName, currencyName, setAmount) { | ||
let currencyValue = null; | ||
if (!currencyName) { | ||
currencyName = obj.currency_code || (process.env.CURRENCY_CODE || 'USD'); | ||
} | ||
if (!obj[fieldName]) { | ||
obj[fieldName] = []; | ||
} | ||
const currencyValues = obj[fieldName]; | ||
currencyValues.forEach((currencyPair) => { | ||
if (currencyPair.currency_code === currencyName) { | ||
if (setAmount) { | ||
currencyPair.value = setAmount; | ||
} | ||
currencyValue = currencyPair.value; | ||
} | ||
if (!obj[fieldName]) { | ||
obj[fieldName] = []; | ||
} | ||
let currencyValues = obj[fieldName]; | ||
for (let currencyPair of currencyValues) { | ||
if (currencyPair.currency_code === currencyName) { | ||
if (setAmount) { | ||
currencyPair.value = setAmount; | ||
} | ||
return currencyPair.value; | ||
} | ||
} | ||
// if we are here it means it's not in the list | ||
if (setAmount) { | ||
let newEntry = { | ||
currency_code: currencyName, | ||
value: setAmount | ||
}; | ||
currencyValues.push(newEntry); | ||
return newEntry.value; | ||
} | ||
}); | ||
// if we are here it means it's not in the list | ||
if (setAmount) { | ||
const newEntry = { | ||
currency_code: currencyName, | ||
value: setAmount, | ||
}; | ||
currencyValues.push(newEntry); | ||
currencyValue = newEntry.value; | ||
} | ||
return currencyValue; | ||
} | ||
Entity.prototype.getCurrencyValue = function getCurrencyValue(fieldName, currencyName) { | ||
return getOrSetCurrencyValue(this, fieldName, currencyName); | ||
}; | ||
Entity.prototype.setCurrencyValue = function setCurrencyValue(fieldName, amount, currencyName) { | ||
return getOrSetCurrencyValue(this, fieldName, currencyName, amount); | ||
}; | ||
module.exports = Entity; |
@@ -1,61 +0,56 @@ | ||
"use strict"; | ||
/* eslint-disable no-restricted-syntax */ | ||
const Entity = require('./entity'); | ||
const EntityMap = require('./entitymap'); | ||
const SchemaProcessing = require('./schemaprocessing'); | ||
var Entity = require('./entity'); | ||
var EntityMap = require('./entitymap'); | ||
var SchemaProcessing = require('./schemaprocessing'); | ||
var EntityList = function () { | ||
}; | ||
// accept an object with user parameters: {'page_limit':10} | ||
EntityList.get = function (base, connection, userParams) { | ||
if (!connection) { | ||
throw new Error("connection object must be provided"); | ||
} | ||
module.exports.get = function get(base, connection, userParams) { | ||
if (!connection) { | ||
throw new Error('connection object must be provided'); | ||
} | ||
return SchemaProcessing.getSchema('userparams') | ||
.then(function (schema) { | ||
let verification = SchemaProcessing.validateJson(userParams, schema); | ||
return SchemaProcessing.getSchema('userparams') | ||
.then((schema) => { | ||
const verification = SchemaProcessing.validateJson(userParams, schema); | ||
if (verification.length !== 0) { | ||
// you may want to specify a custom error type here, and set the verification | ||
// results as a property of them. | ||
throw new Error(verification); | ||
} | ||
if (verification.length !== 0) { | ||
// you may want to specify a custom error type here, and set the verification | ||
// results as a property of them. | ||
throw new Error(verification); | ||
} | ||
// if it looks like a full path just use that; we're here from getNextPage. | ||
let queryString = /^[a-z_]*$/.test(base) ? | ||
connection.buildQueryString(EntityMap.getEndpoint(base), userParams) : base; | ||
// if it looks like a full path just use that; we're here from getNextPage. | ||
const queryString = /^[a-z_]*$/.test(base) ? | ||
connection.buildQueryString(EntityMap.getEndpoint(base), userParams) : base; | ||
return connection.get(queryString); | ||
}) | ||
.then(function (body) { | ||
let content = JSON.parse(body); | ||
return EntityList.processEntityList(content.data, content.meta); | ||
}); | ||
return connection.get(queryString); | ||
}) | ||
.then((body) => { | ||
const content = JSON.parse(body); | ||
return this.processEntityList(content.data, content.meta); | ||
}); | ||
}; | ||
EntityList.processEntityList = function (entities, meta) { | ||
function* EntityGenerator(list) { | ||
for (const entity of list) { | ||
const newEntity = new Entity(entity.entity_type); | ||
newEntity.processEntity(entity); | ||
yield newEntity; | ||
} | ||
} | ||
function* EntityGenerator(entities) { | ||
for (let entity of entities) { | ||
let newEntity = new Entity(entity.entity_type); | ||
newEntity.processEntity(entity); | ||
yield newEntity; | ||
} | ||
} | ||
return { | ||
entities: EntityGenerator(entities), | ||
meta: meta | ||
}; | ||
module.exports.processEntityList = function processEntityList(entities, meta) { | ||
return { | ||
entities: EntityGenerator(entities), | ||
meta, | ||
}; | ||
}; | ||
EntityList.getNextPage = function (retrieved, connection) { | ||
let retrievedNext = retrieved.meta.next_page; | ||
if (typeof retrievedNext !== 'undefined') { | ||
return this.get(retrievedNext, connection); | ||
} | ||
module.exports.getNextPage = function getNextPage(retrieved, connection) { | ||
const retrievedNext = retrieved.meta.next_page; | ||
if (typeof retrievedNext !== 'undefined') { | ||
return this.get(retrievedNext, connection); | ||
} | ||
throw new Error('no next page!'); | ||
}; | ||
module.exports = EntityList; |
@@ -1,284 +0,284 @@ | ||
"use strict"; | ||
let entityMap = { | ||
'atomic_creative': { | ||
'path': '/api/v2.0/atomic_creatives', | ||
'postformat': 'formdata' | ||
}, | ||
'atomic_creatives': { | ||
'path': '/api/v2.0/atomic_creatives', | ||
'postformat': 'formdata' | ||
}, | ||
'ad_server': { | ||
'path': '/api/v2.0/ad_servers', | ||
'postformat': 'formdata' | ||
}, | ||
'ad_servers': { | ||
'path': '/api/v2.0/ad_servers', | ||
'postformat': 'formdata' | ||
}, | ||
'advertiser': { | ||
'path': '/api/v2.0/advertisers', | ||
'postformat': 'formdata' | ||
}, | ||
'advertisers': { | ||
'path': '/api/v2.0/advertisers', | ||
'postformat': 'formdata' | ||
}, | ||
'audience_segment': { | ||
'path': '/api/v2.0/audience_segments', | ||
'postformat': 'formdata' | ||
}, | ||
'audience_segments': { | ||
'path': '/api/v2.0/audience_segments', | ||
'postformat': 'formdata' | ||
}, | ||
'agency': { | ||
'path': '/api/v2.0/agencies', | ||
'postformat': 'formdata' | ||
}, | ||
'agencies': { | ||
'path': '/api/v2.0/agencies', | ||
'postformat': 'formdata' | ||
}, | ||
'campaign': { | ||
'path': '/api/v2.0/campaigns', | ||
'postformat': 'formdata' | ||
}, | ||
'campaigns': { | ||
'path': '/api/v2.0/campaigns', | ||
'postformat': 'formdata' | ||
}, | ||
'concept': { | ||
'path': '/api/v2.0/concepts', | ||
'postformat': 'formdata' | ||
}, | ||
'concepts': { | ||
'path': '/api/v2.0/concepts', | ||
'postformat': 'formdata' | ||
}, | ||
'creative': { | ||
'path': '/api/v2.0/creatives', | ||
'postformat': 'formdata' | ||
}, | ||
'creatives': { | ||
'path': '/api/v2.0/creatives', | ||
'postformat': 'formdata' | ||
}, | ||
'creative_approval': { | ||
'path': '/api/v2.0/creative_approvals', | ||
'postformat': 'formdata' | ||
}, | ||
'creative_approvals': { | ||
'path': '/api/v2.0/creative_approvals', | ||
'postformat': 'formdata' | ||
}, | ||
"deal": { | ||
'path': '/media/v1.0/deals', | ||
'postformat': 'json' | ||
}, | ||
"deals": { | ||
'path': '/media/v1.0/deals', | ||
'postformat': 'json' | ||
}, | ||
"organization": { | ||
'path': '/api/v2.0/organizations', | ||
'postformat': 'formdata' | ||
}, | ||
"organizations": { | ||
'path': '/api/v2.0/organizations', | ||
'postformat': 'formdata' | ||
}, | ||
"pixel": { | ||
'path': '/api/v2.0/pixels', | ||
'postformat': 'formdata' | ||
}, | ||
"pixels": { | ||
'path': '/api/v2.0/pixels', | ||
'postformat': 'formdata' | ||
}, | ||
"pixel_bundle": { | ||
'path': '/api/v2.0/pixel_bundles', | ||
'postformat': 'formdata' | ||
}, | ||
"pixel_bundles": { | ||
'path': '/api/v2.0/pixel_bundles', | ||
'postformat': 'formdata' | ||
}, | ||
"pixel_provider": { | ||
'path': '/api/v2.0/pixel_providers', | ||
'postformat': 'formdata' | ||
}, | ||
"pixel_providers": { | ||
'path': '/api/v2.0/pixel_providers', | ||
'postformat': 'formdata' | ||
}, | ||
"placement_slot": { | ||
'path': '/api/v2.0/placement_slots', | ||
'postformat': 'formdata' | ||
}, | ||
"placement_slots": { | ||
'path': '/api/v2.0/placement_slots', | ||
'postformat': 'formdata' | ||
}, | ||
"publisher": { | ||
'path': '/api/v2.0/publishers', | ||
'postformat': 'formdata' | ||
}, | ||
"publishers": { | ||
'path': '/api/v2.0/publishers', | ||
'postformat': 'formdata' | ||
}, | ||
"publisher_site": { | ||
'path': '/api/v2.0/publisher_sites', | ||
'postformat': 'formdata' | ||
}, | ||
"publisher_sites": { | ||
'path': '/api/v2.0/publisher_sites', | ||
'postformat': 'formdata' | ||
}, | ||
"site_list": { | ||
'path': '/api/v2.0/site_lists', | ||
'postformat': 'formdata' | ||
}, | ||
"site_lists": { | ||
'path': '/api/v2.0/site_lists', | ||
'postformat': 'formdata' | ||
}, | ||
"site_placement": { | ||
'path': '/api/v2.0/site_placement', | ||
'postformat': 'formdata' | ||
}, | ||
"site_placements": { | ||
'path': '/api/v2.0/site_placement', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy": { | ||
'path': '/api/v2.0/strategies', | ||
'postformat': 'formdata' | ||
}, | ||
"strategies": { | ||
'path': '/api/v2.0/strategies', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy_concept": { | ||
'path': '/api/v2.0/strategy_concepts', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy_concepts": { | ||
'path': '/api/v2.0/strategy_concepts', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy_day_part": { | ||
'path': '/api/v2.0/strategy_day_parts', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy_day_parts": { | ||
'path': '/api/v2.0/strategy_day_parts', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy_domain": { | ||
'path': '/api/v2.0/strategy_domains', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy_domains": { | ||
'path': '/api/v2.0/strategy_domains', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy_supply_source": { | ||
'path': '/api/v2.0/strategy_supply_sources', | ||
'postformat': 'formdata' | ||
}, | ||
"strategy_supply_sources": { | ||
'path': '/api/v2.0/strategy_supply_sources', | ||
'postformat': 'formdata' | ||
}, | ||
"target_dimension": { | ||
'path': '/api/v2.0/target_dimensions', | ||
'postformat': 'formdata' | ||
}, | ||
"target_dimensions": { | ||
'path': '/api/v2.0/target_dimensions', | ||
'postformat': 'formdata' | ||
}, | ||
"target_value": { | ||
'path': '/api/v2.0/target_values', | ||
'postformat': 'formdata' | ||
}, | ||
"target_values": { | ||
'path': '/api/v2.0/target_values', | ||
'postformat': 'formdata' | ||
}, | ||
"targeting_vendor": { | ||
'path': '/api/v2.0/targeting_vendors', | ||
'postformat': 'formdata' | ||
}, | ||
"targeting_vendors": { | ||
'path': '/api/v2.0/targeting_vendors', | ||
'postformat': 'formdata' | ||
}, | ||
"user": { | ||
'path': '/api/v2.0/users', | ||
'postformat': 'formdata' | ||
}, | ||
"users": { | ||
'path': '/api/v2.0/users', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor": { | ||
'path': '/api/v2.0/vendors', | ||
'postformat': 'formdata' | ||
}, | ||
"vendors": { | ||
'path': '/api/v2.0/vendors', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor_contract": { | ||
'path': '/api/v2.0/vendor_contracts', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor_contracts": { | ||
'path': '/api/v2.0/vendor_contracts', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor_domain": { | ||
'path': '/api/v2.0/vendor_domains', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor_domains": { | ||
'path': '/api/v2.0/vendor_domains', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor_pixel": { | ||
'path': '/api/v2.0/vendor_pixels', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor_pixels": { | ||
'path': '/api/v2.0/vendor_pixels', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor_pixel_domain": { | ||
'path': '/api/v2.0/vendor_pixel_domains', | ||
'postformat': 'formdata' | ||
}, | ||
"vendor_pixel_domains": { | ||
'path': '/api/v2.0/vendor_pixel_domains', | ||
'postformat': 'formdata' | ||
}, | ||
"vertical": { | ||
'path': '/api/v2.0/verticals', | ||
'postformat': 'formdata' | ||
}, | ||
"verticals": { | ||
'path': '/api/v2.0/verticals', | ||
'postformat': 'formdata' | ||
} | ||
const entityMap = { | ||
atomic_creative: { | ||
path: '/api/v2.0/atomic_creatives', | ||
postformat: 'formdata', | ||
}, | ||
atomic_creatives: { | ||
path: '/api/v2.0/atomic_creatives', | ||
postformat: 'formdata', | ||
}, | ||
ad_server: { | ||
path: '/api/v2.0/ad_servers', | ||
postformat: 'formdata', | ||
}, | ||
ad_servers: { | ||
path: '/api/v2.0/ad_servers', | ||
postformat: 'formdata', | ||
}, | ||
advertiser: { | ||
path: '/api/v2.0/advertisers', | ||
postformat: 'formdata', | ||
}, | ||
advertisers: { | ||
path: '/api/v2.0/advertisers', | ||
postformat: 'formdata', | ||
}, | ||
audience_segment: { | ||
path: '/api/v2.0/audience_segments', | ||
postformat: 'formdata', | ||
}, | ||
audience_segments: { | ||
path: '/api/v2.0/audience_segments', | ||
postformat: 'formdata', | ||
}, | ||
agency: { | ||
path: '/api/v2.0/agencies', | ||
postformat: 'formdata', | ||
}, | ||
agencies: { | ||
path: '/api/v2.0/agencies', | ||
postformat: 'formdata', | ||
}, | ||
campaign: { | ||
path: '/api/v2.0/campaigns', | ||
postformat: 'formdata', | ||
}, | ||
campaigns: { | ||
path: '/api/v2.0/campaigns', | ||
postformat: 'formdata', | ||
}, | ||
concept: { | ||
path: '/api/v2.0/concepts', | ||
postformat: 'formdata', | ||
}, | ||
concepts: { | ||
path: '/api/v2.0/concepts', | ||
postformat: 'formdata', | ||
}, | ||
creative: { | ||
path: '/api/v2.0/creatives', | ||
postformat: 'formdata', | ||
}, | ||
creatives: { | ||
path: '/api/v2.0/creatives', | ||
postformat: 'formdata', | ||
}, | ||
creative_approval: { | ||
path: '/api/v2.0/creative_approvals', | ||
postformat: 'formdata', | ||
}, | ||
creative_approvals: { | ||
path: '/api/v2.0/creative_approvals', | ||
postformat: 'formdata', | ||
}, | ||
deal: { | ||
path: '/media/v1.0/deals', | ||
postformat: 'json', | ||
}, | ||
deals: { | ||
path: '/media/v1.0/deals', | ||
postformat: 'json', | ||
}, | ||
organization: { | ||
path: '/api/v2.0/organizations', | ||
postformat: 'formdata', | ||
}, | ||
organizations: { | ||
path: '/api/v2.0/organizations', | ||
postformat: 'formdata', | ||
}, | ||
pixel: { | ||
path: '/api/v2.0/pixels', | ||
postformat: 'formdata', | ||
}, | ||
pixels: { | ||
path: '/api/v2.0/pixels', | ||
postformat: 'formdata', | ||
}, | ||
pixel_bundle: { | ||
path: '/api/v2.0/pixel_bundles', | ||
postformat: 'formdata', | ||
}, | ||
pixel_bundles: { | ||
path: '/api/v2.0/pixel_bundles', | ||
postformat: 'formdata', | ||
}, | ||
pixel_provider: { | ||
path: '/api/v2.0/pixel_providers', | ||
postformat: 'formdata', | ||
}, | ||
pixel_providers: { | ||
path: '/api/v2.0/pixel_providers', | ||
postformat: 'formdata', | ||
}, | ||
placement_slot: { | ||
path: '/api/v2.0/placement_slots', | ||
postformat: 'formdata', | ||
}, | ||
placement_slots: { | ||
path: '/api/v2.0/placement_slots', | ||
postformat: 'formdata', | ||
}, | ||
publisher: { | ||
path: '/api/v2.0/publishers', | ||
postformat: 'formdata', | ||
}, | ||
publishers: { | ||
path: '/api/v2.0/publishers', | ||
postformat: 'formdata', | ||
}, | ||
publisher_site: { | ||
path: '/api/v2.0/publisher_sites', | ||
postformat: 'formdata', | ||
}, | ||
publisher_sites: { | ||
path: '/api/v2.0/publisher_sites', | ||
postformat: 'formdata', | ||
}, | ||
site_list: { | ||
path: '/api/v2.0/site_lists', | ||
postformat: 'formdata', | ||
}, | ||
site_lists: { | ||
path: '/api/v2.0/site_lists', | ||
postformat: 'formdata', | ||
}, | ||
site_placement: { | ||
path: '/api/v2.0/site_placement', | ||
postformat: 'formdata', | ||
}, | ||
site_placements: { | ||
path: '/api/v2.0/site_placement', | ||
postformat: 'formdata', | ||
}, | ||
strategy: { | ||
path: '/api/v2.0/strategies', | ||
postformat: 'formdata', | ||
}, | ||
strategies: { | ||
path: '/api/v2.0/strategies', | ||
postformat: 'formdata', | ||
}, | ||
strategy_concept: { | ||
path: '/api/v2.0/strategy_concepts', | ||
postformat: 'formdata', | ||
}, | ||
strategy_concepts: { | ||
path: '/api/v2.0/strategy_concepts', | ||
postformat: 'formdata', | ||
}, | ||
strategy_day_part: { | ||
path: '/api/v2.0/strategy_day_parts', | ||
postformat: 'formdata', | ||
}, | ||
strategy_day_parts: { | ||
path: '/api/v2.0/strategy_day_parts', | ||
postformat: 'formdata', | ||
}, | ||
strategy_domain: { | ||
path: '/api/v2.0/strategy_domains', | ||
postformat: 'formdata', | ||
}, | ||
strategy_domains: { | ||
path: '/api/v2.0/strategy_domains', | ||
postformat: 'formdata', | ||
}, | ||
strategy_supply_source: { | ||
path: '/api/v2.0/strategy_supply_sources', | ||
postformat: 'formdata', | ||
}, | ||
strategy_supply_sources: { | ||
path: '/api/v2.0/strategy_supply_sources', | ||
postformat: 'formdata', | ||
}, | ||
target_dimension: { | ||
path: '/api/v2.0/target_dimensions', | ||
postformat: 'formdata', | ||
}, | ||
target_dimensions: { | ||
path: '/api/v2.0/target_dimensions', | ||
postformat: 'formdata', | ||
}, | ||
target_value: { | ||
path: '/api/v2.0/target_values', | ||
postformat: 'formdata', | ||
}, | ||
target_values: { | ||
path: '/api/v2.0/target_values', | ||
postformat: 'formdata', | ||
}, | ||
targeting_vendor: { | ||
path: '/api/v2.0/targeting_vendors', | ||
postformat: 'formdata', | ||
}, | ||
targeting_vendors: { | ||
path: '/api/v2.0/targeting_vendors', | ||
postformat: 'formdata', | ||
}, | ||
user: { | ||
path: '/api/v2.0/users', | ||
postformat: 'formdata', | ||
}, | ||
users: { | ||
path: '/api/v2.0/users', | ||
postformat: 'formdata', | ||
}, | ||
vendor: { | ||
path: '/api/v2.0/vendors', | ||
postformat: 'formdata', | ||
}, | ||
vendors: { | ||
path: '/api/v2.0/vendors', | ||
postformat: 'formdata', | ||
}, | ||
vendor_contract: { | ||
path: '/api/v2.0/vendor_contracts', | ||
postformat: 'formdata', | ||
}, | ||
vendor_contracts: { | ||
path: '/api/v2.0/vendor_contracts', | ||
postformat: 'formdata', | ||
}, | ||
vendor_domain: { | ||
path: '/api/v2.0/vendor_domains', | ||
postformat: 'formdata', | ||
}, | ||
vendor_domains: { | ||
path: '/api/v2.0/vendor_domains', | ||
postformat: 'formdata', | ||
}, | ||
vendor_pixel: { | ||
path: '/api/v2.0/vendor_pixels', | ||
postformat: 'formdata', | ||
}, | ||
vendor_pixels: { | ||
path: '/api/v2.0/vendor_pixels', | ||
postformat: 'formdata', | ||
}, | ||
vendor_pixel_domain: { | ||
path: '/api/v2.0/vendor_pixel_domains', | ||
postformat: 'formdata', | ||
}, | ||
vendor_pixel_domains: { | ||
path: '/api/v2.0/vendor_pixel_domains', | ||
postformat: 'formdata', | ||
}, | ||
vertical: { | ||
path: '/api/v2.0/verticals', | ||
postformat: 'formdata', | ||
}, | ||
verticals: { | ||
path: '/api/v2.0/verticals', | ||
postformat: 'formdata', | ||
}, | ||
}; | ||
function getEndpoint(entity) { | ||
return entityMap[entity].path; | ||
return entityMap[entity].path; | ||
} | ||
function getPostFormat(entity) { | ||
return entityMap[entity].postformat; | ||
return entityMap[entity].postformat; | ||
} | ||
@@ -285,0 +285,0 @@ |
@@ -1,43 +0,35 @@ | ||
'use strict'; | ||
var csv = require('babyparse'); | ||
const csv = require('babyparse'); | ||
var Report = function(type, connection) { | ||
this.report_type = type; | ||
const Report = function Report(type, connection) { | ||
this.report_type = type; | ||
if (connection) { | ||
this.get(connection); | ||
} | ||
if (connection) { | ||
this.get(connection); | ||
} | ||
}; | ||
Report.prototype.get = function(connection, userParams) { | ||
if (!connection) { | ||
throw new Error('connection object must be provided'); | ||
} | ||
var that = this; | ||
// This prototype does no evaluation of required fields. | ||
Report.prototype.get = function get(connection, userParams) { | ||
if (!connection) { | ||
throw new Error('connection object must be provided'); | ||
} | ||
// This prototype does no evaluation of required fields. | ||
var queryString = connection.buildQueryString('/reporting/v1/std/' + this.report_type, userParams); | ||
return connection.get(queryString) | ||
.then(function(body) { | ||
var results = csv.parse(body.slice(0, -2), { header: true }); // Remove last \n to evenly parse the CSV. | ||
return results; | ||
}); | ||
const queryString = connection.buildQueryString(`/reporting/v1/std/${this.report_type}`, userParams); | ||
return connection.get(queryString) | ||
.then(body => csv.parse(body.slice(0, -2), | ||
{ header: true })); // Remove last \n to evenly parse the CSV. | ||
}; | ||
Report.prototype.getMeta = function(connection) { | ||
if (!connection) { | ||
throw new Error('connection object must be provided'); | ||
} | ||
var that = this; | ||
if (this.report_type != 'meta') { | ||
this.report_type = this.report_type + '/meta'; | ||
} | ||
var queryString = connection.buildQueryString('/reporting/v1/std/' + this.report_type); | ||
return connection.get(queryString) | ||
.then(function(body) { | ||
var content = JSON.parse(body); | ||
return content; | ||
}); | ||
Report.prototype.getMeta = function getMeta(connection) { | ||
if (!connection) { | ||
throw new Error('connection object must be provided'); | ||
} | ||
if (this.report_type !== 'meta') { | ||
this.report_type = `${this.report_type}/meta`; | ||
} | ||
const queryString = connection.buildQueryString(`/reporting/v1/std/${this.report_type}`); | ||
return connection.get(queryString) | ||
.then(body => JSON.parse(body)); | ||
}; | ||
module.exports = Report; |
@@ -1,16 +0,16 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"ad_server": { | ||
"id": "/ad_server", | ||
"type": "object", | ||
"properties": {}, | ||
"required": [] | ||
ad_server: { | ||
id: '/ad_server', | ||
type: 'object', | ||
properties: {}, | ||
required: [], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/ad_server', | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/ad_server" | ||
} | ||
] | ||
], | ||
}; |
@@ -1,82 +0,82 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"advertiser": { | ||
"id": "/advertiser", | ||
"type": "object", | ||
"properties": { | ||
"minimize_multi_ads": { | ||
"id": "/advertiser/data/minimize_multi_ads", | ||
"type": "boolean" | ||
}, | ||
"frequency_type": { | ||
"id": "/advertiser/data/frequency_type", | ||
"enum": [ | ||
"asap", | ||
"even", | ||
"no-limit" | ||
] | ||
}, | ||
"frequency_interval": { | ||
"id": "/advertiser/data/frequency_interval", | ||
"enum": [ | ||
"hour", | ||
"day", | ||
"week", | ||
"month", | ||
"not-applicable" | ||
] | ||
}, | ||
"status": { | ||
"id": "/advertiser/data/status", | ||
"type": "boolean" | ||
}, | ||
"dmp_enabled": { | ||
"id": "/advertiser/data/dmp_enabled", | ||
"type": "string" | ||
}, | ||
"agency_id": { | ||
"id": "/advertiser/data/agency_id", | ||
"type": "integer" | ||
}, | ||
"allow_x_strat_optimization": { | ||
"id": "/advertiser/data/allow_x_strat_optimization", | ||
"type": "boolean" | ||
}, | ||
"domain": { | ||
"id": "/advertiser/data/domain", | ||
"type": "string" | ||
}, | ||
"ad_server_id": { | ||
"id": "/advertiser/data/ad_server_id", | ||
"type": "integer" | ||
}, | ||
"updated_on": { | ||
"id": "/advertiser/data/updated_on", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"vertical_id": { | ||
"id": "/advertiser/data/vertical_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/advertiser/data/created_on", | ||
"type": "string", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"ad_server_id", | ||
"agency_id", | ||
"domain", | ||
"vertical_id" | ||
] | ||
advertiser: { | ||
id: '/advertiser', | ||
type: 'object', | ||
properties: { | ||
minimize_multi_ads: { | ||
id: '/advertiser/data/minimize_multi_ads', | ||
type: 'boolean', | ||
}, | ||
frequency_type: { | ||
id: '/advertiser/data/frequency_type', | ||
enum: [ | ||
'asap', | ||
'even', | ||
'no-limit', | ||
], | ||
}, | ||
frequency_interval: { | ||
id: '/advertiser/data/frequency_interval', | ||
enum: [ | ||
'hour', | ||
'day', | ||
'week', | ||
'month', | ||
'not-applicable', | ||
], | ||
}, | ||
status: { | ||
id: '/advertiser/data/status', | ||
type: 'boolean', | ||
}, | ||
dmp_enabled: { | ||
id: '/advertiser/data/dmp_enabled', | ||
type: 'string', | ||
}, | ||
agency_id: { | ||
id: '/advertiser/data/agency_id', | ||
type: 'integer', | ||
}, | ||
allow_x_strat_optimization: { | ||
id: '/advertiser/data/allow_x_strat_optimization', | ||
type: 'boolean', | ||
}, | ||
domain: { | ||
id: '/advertiser/data/domain', | ||
type: 'string', | ||
}, | ||
ad_server_id: { | ||
id: '/advertiser/data/ad_server_id', | ||
type: 'integer', | ||
}, | ||
updated_on: { | ||
id: '/advertiser/data/updated_on', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
vertical_id: { | ||
id: '/advertiser/data/vertical_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/advertiser/data/created_on', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/advertiser" | ||
} | ||
] | ||
required: [ | ||
'ad_server_id', | ||
'agency_id', | ||
'domain', | ||
'vertical_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/advertiser', | ||
}, | ||
], | ||
}; |
@@ -1,48 +0,48 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"agency": { | ||
"id": "/agency", | ||
"type": "object", | ||
"properties": { | ||
"organization_id": { | ||
"id": "/agency/data/organization_id", | ||
"type": "integer" | ||
}, | ||
"status": { | ||
"id": "/agency/data/status", | ||
"type": "boolean" | ||
}, | ||
"allow_x_adv_pixels": { | ||
"id": "/agency/data/allow_x_adv_pixels", | ||
"type": "boolean" | ||
}, | ||
"allow_x_adv_optimization": { | ||
"id": "/agency/data/allow_x_adv_optimization", | ||
"type": "boolean" | ||
}, | ||
"updated_on": { | ||
"id": "/agency/data/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"created_on": { | ||
"id": "/agency/data/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"organization_id" | ||
] | ||
agency: { | ||
id: '/agency', | ||
type: 'object', | ||
properties: { | ||
organization_id: { | ||
id: '/agency/data/organization_id', | ||
type: 'integer', | ||
}, | ||
status: { | ||
id: '/agency/data/status', | ||
type: 'boolean', | ||
}, | ||
allow_x_adv_pixels: { | ||
id: '/agency/data/allow_x_adv_pixels', | ||
type: 'boolean', | ||
}, | ||
allow_x_adv_optimization: { | ||
id: '/agency/data/allow_x_adv_optimization', | ||
type: 'boolean', | ||
}, | ||
updated_on: { | ||
id: '/agency/data/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
created_on: { | ||
id: '/agency/data/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
required: [ | ||
'organization_id', | ||
], | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/agency" | ||
} | ||
] | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/agency', | ||
}, | ||
], | ||
}; |
@@ -1,241 +0,241 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"atomic_creative": { | ||
"id": "/atomic_creative", | ||
"type": "object", | ||
"properties": { | ||
"build_date": { | ||
"id": "/atomic_creative/data/build_date", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
atomic_creative: { | ||
id: '/atomic_creative', | ||
type: 'object', | ||
properties: { | ||
build_date: { | ||
id: '/atomic_creative/data/build_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
"created_on": { | ||
"id": "/atomic_creative/data/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
created_on: { | ||
id: '/atomic_creative/data/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
"last_modified": { | ||
"id": "/atomic_creative/data/last_modified", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
last_modified: { | ||
id: '/atomic_creative/data/last_modified', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
"updated_on": { | ||
"id": "/atomic_creative/data/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
updated_on: { | ||
id: '/atomic_creative/data/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
"version": { | ||
"id": "/atomic_creative/data/version", | ||
"type": "integer" | ||
version: { | ||
id: '/atomic_creative/data/version', | ||
type: 'integer', | ||
}, | ||
"advertiser_id": { | ||
"id": "/atomic_creative/data/advertiser_id", | ||
"type": "integer" | ||
advertiser_id: { | ||
id: '/atomic_creative/data/advertiser_id', | ||
type: 'integer', | ||
}, | ||
"ad_format": { | ||
"id": "/atomic_creative/data/ad_format", | ||
"enum": [ | ||
"DISPLAY", | ||
"EXPANDABLE", | ||
"MOBILE" | ||
], | ||
"default": "DISPLAY" | ||
ad_format: { | ||
id: '/atomic_creative/data/ad_format', | ||
enum: [ | ||
'DISPLAY', | ||
'EXPANDABLE', | ||
'MOBILE', | ||
], | ||
default: 'DISPLAY', | ||
}, | ||
"ad_server_type": { | ||
"id": "/atomic_creative/data/ad_server_type", | ||
"enum": [ | ||
"ATLAS", | ||
"DART", | ||
"EYEWONDER", | ||
"MEDIAMIND", | ||
"MEDIAPLEX", | ||
"POINTROLL", | ||
"YIELD_MANAGER", | ||
"TERMINALONE", | ||
"MEDIAFORGE", | ||
"OTHER" | ||
], | ||
"default": "OTHER" | ||
ad_server_type: { | ||
id: '/atomic_creative/data/ad_server_type', | ||
enum: [ | ||
'ATLAS', | ||
'DART', | ||
'EYEWONDER', | ||
'MEDIAMIND', | ||
'MEDIAPLEX', | ||
'POINTROLL', | ||
'YIELD_MANAGER', | ||
'TERMINALONE', | ||
'MEDIAFORGE', | ||
'OTHER', | ||
], | ||
default: 'OTHER', | ||
}, | ||
"approval_status": { | ||
"id": "/atomic_creative/data/approval_status", | ||
"type": "string", | ||
"readonly": true | ||
approval_status: { | ||
id: '/atomic_creative/data/approval_status', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
"build_errors": { | ||
"id": "/atomic_creative/data/build_errors", | ||
"type": "string", | ||
"readonly": true | ||
build_errors: { | ||
id: '/atomic_creative/data/build_errors', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
"built": { | ||
"id": "/atomic_creative/data/built", | ||
"type": "boolean", | ||
"readonly": true | ||
built: { | ||
id: '/atomic_creative/data/built', | ||
type: 'boolean', | ||
readonly: true, | ||
}, | ||
"built_by_user_id": { | ||
"id": "/atomic_creative/data/built_by_user_id", | ||
"type": "integer", | ||
"readonly": true | ||
built_by_user_id: { | ||
id: '/atomic_creative/data/built_by_user_id', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
"click_through_url": { | ||
"id": "/atomic_creative/data/click_through_url", | ||
"type": "string" | ||
click_through_url: { | ||
id: '/atomic_creative/data/click_through_url', | ||
type: 'string', | ||
}, | ||
"click_url": { | ||
"id": "/atomic_creative/data/click_url", | ||
"type": "string" | ||
click_url: { | ||
id: '/atomic_creative/data/click_url', | ||
type: 'string', | ||
}, | ||
"concept_id": { | ||
"id": "/atomic_creative/data/concept_id", | ||
"type": "integer" | ||
concept_id: { | ||
id: '/atomic_creative/data/concept_id', | ||
type: 'integer', | ||
}, | ||
"creative_import_file_id": { | ||
"id": "/atomic_creative/data/creative_import_file_id", | ||
"type": "int" | ||
creative_import_file_id: { | ||
id: '/atomic_creative/data/creative_import_file_id', | ||
type: 'int', | ||
}, | ||
"edited_tag": { | ||
"id": "/atomic_creative/data/edited_tag", | ||
"type": "string" | ||
edited_tag: { | ||
id: '/atomic_creative/data/edited_tag', | ||
type: 'string', | ||
}, | ||
"end_date": { | ||
"id": "/atomic_creative/data/end_date", | ||
"type": "string", | ||
"format": "datetimezone" | ||
end_date: { | ||
id: '/atomic_creative/data/end_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
"expansion_direction": { | ||
"id": "/atomic_creative/data/expansion_direction", | ||
"type": "string", | ||
"default": "NONRESTRICTED" | ||
expansion_direction: { | ||
id: '/atomic_creative/data/expansion_direction', | ||
type: 'string', | ||
default: 'NONRESTRICTED', | ||
}, | ||
"expansion_trigger": { | ||
"id": "/atomic_creative/data/expansion_trigger", | ||
"enum": [ | ||
"AUTOMATIC", | ||
"MOUSEOVER", | ||
"CLICK" | ||
], | ||
"default": "CLICK" | ||
expansion_trigger: { | ||
id: '/atomic_creative/data/expansion_trigger', | ||
enum: [ | ||
'AUTOMATIC', | ||
'MOUSEOVER', | ||
'CLICK', | ||
], | ||
default: 'CLICK', | ||
}, | ||
"external_identifier": { | ||
"id": "/atomic_creative/data/external_identifier", | ||
"type": "string" | ||
external_identifier: { | ||
id: '/atomic_creative/data/external_identifier', | ||
type: 'string', | ||
}, | ||
"file_type": { | ||
"id": "/atomic_creative/data/file_type", | ||
"enum": [ | ||
"swf", | ||
"gif", | ||
"html5", | ||
"jpg", | ||
"jpeg", | ||
"tif", | ||
"tiff", | ||
"png", | ||
"unknown", | ||
"vast" | ||
], | ||
"default": "unknown" | ||
file_type: { | ||
id: '/atomic_creative/data/file_type', | ||
enum: [ | ||
'swf', | ||
'gif', | ||
'html5', | ||
'jpg', | ||
'jpeg', | ||
'tif', | ||
'tiff', | ||
'png', | ||
'unknown', | ||
'vast', | ||
], | ||
default: 'unknown', | ||
}, | ||
"has_sound": { | ||
"id": "/atomic_creative/data/has_sound", | ||
"type": "boolean" | ||
has_sound: { | ||
id: '/atomic_creative/data/has_sound', | ||
type: 'boolean', | ||
}, | ||
"height": { | ||
"id": "/atomic_creative/data/height", | ||
"type": "integer" | ||
height: { | ||
id: '/atomic_creative/data/height', | ||
type: 'integer', | ||
}, | ||
"is_https": { | ||
"id": "/atomic_creative/data/is_https", | ||
"type": "boolean" | ||
is_https: { | ||
id: '/atomic_creative/data/is_https', | ||
type: 'boolean', | ||
}, | ||
"is_multi_creative": { | ||
"id": "/atomic_creative/data/is_multi_creative", | ||
"type": "boolean" | ||
is_multi_creative: { | ||
id: '/atomic_creative/data/is_multi_creative', | ||
type: 'boolean', | ||
}, | ||
"media_type": { | ||
"id": "/atomic_creative/data/media_type", | ||
"enum": [ | ||
"display", | ||
"video", | ||
"mobile" | ||
], | ||
"default": "display" | ||
media_type: { | ||
id: '/atomic_creative/data/media_type', | ||
enum: [ | ||
'display', | ||
'video', | ||
'mobile', | ||
], | ||
default: 'display', | ||
}, | ||
"rejected_reason": { | ||
"id": "/atomic_creative/data/rejected_reason", | ||
"type": "string" | ||
rejected_reason: { | ||
id: '/atomic_creative/data/rejected_reason', | ||
type: 'string', | ||
}, | ||
"rich_media": { | ||
"id": "/atomic_creative/data/rich_media", | ||
"type": "boolean" | ||
rich_media: { | ||
id: '/atomic_creative/data/rich_media', | ||
type: 'boolean', | ||
}, | ||
"rich_media_provider": { | ||
"id": "/atomic_creative/data/rich_media_provider", | ||
"type": "string" | ||
rich_media_provider: { | ||
id: '/atomic_creative/data/rich_media_provider', | ||
type: 'string', | ||
}, | ||
"start_date": { | ||
"id": "/atomic_creative/data/start_date", | ||
"type": "string", | ||
"format": "datetimezone" | ||
start_date: { | ||
id: '/atomic_creative/data/start_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
"status": { | ||
"id": "/atomic_creative/data/status", | ||
"type": "boolean" | ||
status: { | ||
id: '/atomic_creative/data/status', | ||
type: 'boolean', | ||
}, | ||
"t1as": { | ||
"id": "/atomic_creative/data/t1as", | ||
"type": "boolean", | ||
"readonly": true | ||
t1as: { | ||
id: '/atomic_creative/data/t1as', | ||
type: 'boolean', | ||
readonly: true, | ||
}, | ||
"tag": { | ||
"id": "/atomic_creative/data/tag", | ||
"type": "string" | ||
tag: { | ||
id: '/atomic_creative/data/tag', | ||
type: 'string', | ||
}, | ||
"tag_type": { | ||
"id": "/atomic_creative/data/tag_type", | ||
"enum": [ | ||
"IFRAME", | ||
"IMG", | ||
"NOSCRIPT", | ||
"SCRIPT" | ||
], | ||
"default": "NOSCRIPT" | ||
tag_type: { | ||
id: '/atomic_creative/data/tag_type', | ||
enum: [ | ||
'IFRAME', | ||
'IMG', | ||
'NOSCRIPT', | ||
'SCRIPT', | ||
], | ||
default: 'NOSCRIPT', | ||
}, | ||
"tpas_ad_tag": { | ||
"id": "/atomic_creative/data/tpas_ad_tag", | ||
"type": "string" | ||
tpas_ad_tag: { | ||
id: '/atomic_creative/data/tpas_ad_tag', | ||
type: 'string', | ||
}, | ||
"tpas_ad_tag_name": { | ||
"id": "/atomic_creative/data/tpas_ad_tag_name", | ||
"type": "string" | ||
tpas_ad_tag_name: { | ||
id: '/atomic_creative/data/tpas_ad_tag_name', | ||
type: 'string', | ||
}, | ||
"width": { | ||
"id": "/atomic_creative/data/width", | ||
"type": "integer" | ||
} | ||
width: { | ||
id: '/atomic_creative/data/width', | ||
type: 'integer', | ||
}, | ||
}, | ||
"required": [ | ||
"ad_server_type", | ||
"advertiser_id", | ||
"concept_id", | ||
"external_identifier", | ||
"file_type", | ||
"height", | ||
"width", | ||
"tag", | ||
"tag_type", | ||
"tpas_ad_tag_name" | ||
] | ||
required: [ | ||
'ad_server_type', | ||
'advertiser_id', | ||
'concept_id', | ||
'external_identifier', | ||
'file_type', | ||
'height', | ||
'width', | ||
'tag', | ||
'tag_type', | ||
'tpas_ad_tag_name', | ||
], | ||
}, | ||
"allOf": [ | ||
allOf: [ | ||
common.entity, | ||
{ | ||
"$ref": "#/atomic_creative" | ||
} | ||
] | ||
$ref: '#/atomic_creative', | ||
}, | ||
], | ||
}; |
@@ -1,55 +0,55 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"audience_segment": { | ||
"id": "/audience_segment", | ||
"type": "object", | ||
"properties": { | ||
"buyable": { | ||
"id": "/audience_segment/data/buyable", | ||
"type": "boolean" | ||
audience_segment: { | ||
id: '/audience_segment', | ||
type: 'object', | ||
properties: { | ||
buyable: { | ||
id: '/audience_segment/data/buyable', | ||
type: 'boolean', | ||
}, | ||
"child_count": { | ||
"id": "/audience_segment/data/child_count", | ||
"type": "integer", | ||
"readonly": true | ||
child_count: { | ||
id: '/audience_segment/data/child_count', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
"audience_vendor_id": { | ||
"id": "/audience_segment/data/audience_vendor_id", | ||
"type": "integer", | ||
"readonly": true | ||
audience_vendor_id: { | ||
id: '/audience_segment/data/audience_vendor_id', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
"full_path": { | ||
"id": "/audience_segment/data/full_path", | ||
"type": "string", | ||
"readonly": true | ||
full_path: { | ||
id: '/audience_segment/data/full_path', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
"type": { | ||
"id": "/audience_segment/data/type", | ||
"type": "type", | ||
"readonly": true | ||
type: { | ||
id: '/audience_segment/data/type', | ||
type: 'type', | ||
readonly: true, | ||
}, | ||
"updated_on": { | ||
"id": "/audience_segment/data/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
updated_on: { | ||
id: '/audience_segment/data/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
"created_on": { | ||
"id": "/audience_segment/data/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
created_on: { | ||
id: '/audience_segment/data/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"required": [ | ||
] | ||
required: [ | ||
], | ||
}, | ||
"allOf": [ | ||
allOf: [ | ||
common.entity, | ||
{ | ||
"$ref": "#/audience_segment" | ||
} | ||
] | ||
$ref: '#/audience_segment', | ||
}, | ||
], | ||
}; |
@@ -1,216 +0,216 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"campaign": { | ||
"id": "/campaign", | ||
"type": "object", | ||
"properties": { | ||
"ad_server_fee": { | ||
"id": "/campaign/ad_server_fee", | ||
"type": "number" | ||
}, | ||
"ad_server_id": { | ||
"id": "/campaign/ad_server_id", | ||
"type": "integer" | ||
}, | ||
"ad_server_password": { | ||
"id": "/campaign/ad_server_password", | ||
"type": "string" | ||
}, | ||
"ad_server_username": { | ||
"id": "/campaign/ad_server_username", | ||
"type": "string" | ||
}, | ||
"advertiser_id": { | ||
"id": "/campaign/advertiser_id", | ||
"type": "integer" | ||
}, | ||
"agency_fee_pct": { | ||
"id": "/campaign/agency_fee_pct", | ||
"type": "number" | ||
}, | ||
"conversion_type": { | ||
"id": "/campaign/conversion_type", | ||
"enum": [ | ||
"every", | ||
"one", | ||
"variable" | ||
], | ||
"default": "variable" | ||
}, | ||
"conversion_variable_minutes": { | ||
"id": "/campaign/conversion_variable_minutes", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/campaign/created_on", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"currency_code": { | ||
"id": "/campaign/currency_code", | ||
"type": "string" | ||
}, | ||
"dcs_data_is_campaign_level": { | ||
"id": "/campaign/dcs_data_is_campaign_level", | ||
"type": "boolean" | ||
}, | ||
"end_date": { | ||
"id": "/campaign/end_date", | ||
"type": "string", | ||
"format": "datetimezone" | ||
}, | ||
"frequency_amount": { | ||
"id": "/campaign/frequency_amount", | ||
"type": "integer" | ||
}, | ||
"frequency_interval": { | ||
"id": "/campaign/frequency_interval", | ||
"enum": [ | ||
"hour", | ||
"day", | ||
"week", | ||
"month", | ||
"not-applicable" | ||
], | ||
"default": "not-applicable" | ||
}, | ||
"frequency_type": { | ||
"id": "/campaign/frequency_type", | ||
"enum": [ | ||
"even", | ||
"asap", | ||
"no-limit" | ||
], | ||
"default": "no-limit" | ||
}, | ||
"goal_alert": { | ||
"type": "string" | ||
}, | ||
"goal_category": { | ||
"id": "/campaign/goal_category", | ||
"enum": [ | ||
"audience", | ||
"engagement", | ||
"response" | ||
] | ||
}, | ||
"goal_type": { | ||
"id": "/campaign/goal_type", | ||
"enum": [ | ||
"spend", | ||
"reach", | ||
"cpc", | ||
"cpe", | ||
"cpa", | ||
"roi" | ||
] | ||
}, | ||
"goal_value": common.currency_array, | ||
"has_custom_attribution": { | ||
"id": "/campaign/has_custom_attribution", | ||
"type": "boolean" | ||
}, | ||
"io_name": { | ||
"id": "/campaign/io_name", | ||
"type": "string" | ||
}, | ||
"io_reference_num": { | ||
"id": "/campaign/io_reference_num", | ||
"type": "string" | ||
}, | ||
"initial_start_date": { | ||
"id": "/campaign/initial_start_date", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"margin_pct": { | ||
"id": "/campaign/margin_pct", | ||
"type": "number" | ||
}, | ||
"merit_pixel_id": { | ||
"id": "/campaign/merit_pixel_id", | ||
"type": "integer" | ||
}, | ||
"pacing_alert": { | ||
"id": "/campaign/pacing_alert", | ||
"type": "number" | ||
}, | ||
"pc_window_minutes": { | ||
"id": "/campaign/pc_window_minutes", | ||
"type": "integer" | ||
}, | ||
"pv_pct": { | ||
"id": "/campaign/pv_pct", | ||
"type": "number" | ||
}, | ||
"pv_window_minutes": { | ||
"id": "/campaign/pv_window_minutes", | ||
"type": "integer" | ||
}, | ||
"service_type": { | ||
"id": "/campaign/service_type", | ||
"enum": [ | ||
"SELF", | ||
"MANAGED" | ||
], | ||
"default": "SELF" | ||
}, | ||
"spend_cap_amount": { | ||
"id": "/campaign/spend_cap_amount", | ||
"type": "number" | ||
}, | ||
"spend_cap_automatic": { | ||
"id": "/campaign/spend_cap_automatic", | ||
"type": "boolean" | ||
}, | ||
"spend_cap_enabled": { | ||
"id": "/campaign/spend_cap_enabled", | ||
"type": "boolean" | ||
}, | ||
"start_date": { | ||
"id": "/campaign/start_date", | ||
"type": "string", | ||
"format": "datetimezone" | ||
}, | ||
"status": { | ||
"id": "/campaign/status", | ||
"type": "boolean" | ||
}, | ||
"total_budget": common.currency_array, | ||
"updated_on": { | ||
"id": "/campaign/updated_on", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"use_default_ad_server": { | ||
"id": "/campaign/use_default_ad_server", | ||
"type": "boolean" | ||
}, | ||
"use_mm_freq": { | ||
"id": "/campaign/use_mm_freq", | ||
"type": "boolean" | ||
}, | ||
"zone_name": { | ||
"id": "/campaign/zone_name", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"ad_server_id", | ||
"advertiser_id", | ||
"end_date", | ||
"goal_type", | ||
"goal_value", | ||
"service_type", | ||
"start_date", | ||
"total_budget" | ||
] | ||
campaign: { | ||
id: '/campaign', | ||
type: 'object', | ||
properties: { | ||
ad_server_fee: { | ||
id: '/campaign/ad_server_fee', | ||
type: 'number', | ||
}, | ||
ad_server_id: { | ||
id: '/campaign/ad_server_id', | ||
type: 'integer', | ||
}, | ||
ad_server_password: { | ||
id: '/campaign/ad_server_password', | ||
type: 'string', | ||
}, | ||
ad_server_username: { | ||
id: '/campaign/ad_server_username', | ||
type: 'string', | ||
}, | ||
advertiser_id: { | ||
id: '/campaign/advertiser_id', | ||
type: 'integer', | ||
}, | ||
agency_fee_pct: { | ||
id: '/campaign/agency_fee_pct', | ||
type: 'number', | ||
}, | ||
conversion_type: { | ||
id: '/campaign/conversion_type', | ||
enum: [ | ||
'every', | ||
'one', | ||
'variable', | ||
], | ||
default: 'variable', | ||
}, | ||
conversion_variable_minutes: { | ||
id: '/campaign/conversion_variable_minutes', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/campaign/created_on', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
currency_code: { | ||
id: '/campaign/currency_code', | ||
type: 'string', | ||
}, | ||
dcs_data_is_campaign_level: { | ||
id: '/campaign/dcs_data_is_campaign_level', | ||
type: 'boolean', | ||
}, | ||
end_date: { | ||
id: '/campaign/end_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
frequency_amount: { | ||
id: '/campaign/frequency_amount', | ||
type: 'integer', | ||
}, | ||
frequency_interval: { | ||
id: '/campaign/frequency_interval', | ||
enum: [ | ||
'hour', | ||
'day', | ||
'week', | ||
'month', | ||
'not-applicable', | ||
], | ||
default: 'not-applicable', | ||
}, | ||
frequency_type: { | ||
id: '/campaign/frequency_type', | ||
enum: [ | ||
'even', | ||
'asap', | ||
'no-limit', | ||
], | ||
default: 'no-limit', | ||
}, | ||
goal_alert: { | ||
type: 'string', | ||
}, | ||
goal_category: { | ||
id: '/campaign/goal_category', | ||
enum: [ | ||
'audience', | ||
'engagement', | ||
'response', | ||
], | ||
}, | ||
goal_type: { | ||
id: '/campaign/goal_type', | ||
enum: [ | ||
'spend', | ||
'reach', | ||
'cpc', | ||
'cpe', | ||
'cpa', | ||
'roi', | ||
], | ||
}, | ||
goal_value: common.currency_array, | ||
has_custom_attribution: { | ||
id: '/campaign/has_custom_attribution', | ||
type: 'boolean', | ||
}, | ||
io_name: { | ||
id: '/campaign/io_name', | ||
type: 'string', | ||
}, | ||
io_reference_num: { | ||
id: '/campaign/io_reference_num', | ||
type: 'string', | ||
}, | ||
initial_start_date: { | ||
id: '/campaign/initial_start_date', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
margin_pct: { | ||
id: '/campaign/margin_pct', | ||
type: 'number', | ||
}, | ||
merit_pixel_id: { | ||
id: '/campaign/merit_pixel_id', | ||
type: 'integer', | ||
}, | ||
pacing_alert: { | ||
id: '/campaign/pacing_alert', | ||
type: 'number', | ||
}, | ||
pc_window_minutes: { | ||
id: '/campaign/pc_window_minutes', | ||
type: 'integer', | ||
}, | ||
pv_pct: { | ||
id: '/campaign/pv_pct', | ||
type: 'number', | ||
}, | ||
pv_window_minutes: { | ||
id: '/campaign/pv_window_minutes', | ||
type: 'integer', | ||
}, | ||
service_type: { | ||
id: '/campaign/service_type', | ||
enum: [ | ||
'SELF', | ||
'MANAGED', | ||
], | ||
default: 'SELF', | ||
}, | ||
spend_cap_amount: { | ||
id: '/campaign/spend_cap_amount', | ||
type: 'number', | ||
}, | ||
spend_cap_automatic: { | ||
id: '/campaign/spend_cap_automatic', | ||
type: 'boolean', | ||
}, | ||
spend_cap_enabled: { | ||
id: '/campaign/spend_cap_enabled', | ||
type: 'boolean', | ||
}, | ||
start_date: { | ||
id: '/campaign/start_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
status: { | ||
id: '/campaign/status', | ||
type: 'boolean', | ||
}, | ||
total_budget: common.currency_array, | ||
updated_on: { | ||
id: '/campaign/updated_on', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
use_default_ad_server: { | ||
id: '/campaign/use_default_ad_server', | ||
type: 'boolean', | ||
}, | ||
use_mm_freq: { | ||
id: '/campaign/use_mm_freq', | ||
type: 'boolean', | ||
}, | ||
zone_name: { | ||
id: '/campaign/zone_name', | ||
type: 'string', | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/campaign" | ||
} | ||
] | ||
required: [ | ||
'ad_server_id', | ||
'advertiser_id', | ||
'end_date', | ||
'goal_type', | ||
'goal_value', | ||
'service_type', | ||
'start_date', | ||
'total_budget', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/campaign', | ||
}, | ||
], | ||
}; |
module.exports = { | ||
"entity": { | ||
"id": "/entity", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"id": "/entity/id", | ||
"type": "integer", | ||
"readonly": true | ||
}, | ||
"entity_type": { | ||
"id": "/entity/entity_type", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"name": { | ||
"id": "/entity/name", | ||
"type": "string" | ||
}, | ||
"version": { | ||
"id": "/entity/version", | ||
"type": "integer" | ||
}, | ||
"meta": { | ||
"id": "/entity/meta", | ||
"type": "object", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"entity_type", | ||
"name" | ||
] | ||
entity: { | ||
id: '/entity', | ||
type: 'object', | ||
properties: { | ||
id: { | ||
id: '/entity/id', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
entity_type: { | ||
id: '/entity/entity_type', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
name: { | ||
id: '/entity/name', | ||
type: 'string', | ||
}, | ||
version: { | ||
id: '/entity/version', | ||
type: 'integer', | ||
}, | ||
meta: { | ||
id: '/entity/meta', | ||
type: 'object', | ||
readonly: true, | ||
}, | ||
}, | ||
"currency_array": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"currency_code": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "number" | ||
} | ||
} | ||
required: [ | ||
'entity_type', | ||
'name', | ||
], | ||
}, | ||
currency_array: { | ||
type: 'array', | ||
items: { | ||
type: 'object', | ||
properties: { | ||
currency_code: { | ||
type: 'string', | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
value: { | ||
type: 'number', | ||
}, | ||
}, | ||
}, | ||
"logical_and_or": { | ||
"type": { | ||
"enum": [ | ||
"AND", | ||
"OR" | ||
] | ||
}, | ||
"default": "OR" | ||
} | ||
minItems: 1, | ||
uniqueItems: true, | ||
}, | ||
logical_and_or: { | ||
type: { | ||
enum: [ | ||
'AND', | ||
'OR', | ||
], | ||
}, | ||
default: 'OR', | ||
}, | ||
}; |
@@ -1,38 +0,38 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"concept": { | ||
"id": "/concept", | ||
"type": "object", | ||
"properties": { | ||
"advertiser_id": { | ||
"id": "/concept/advertiser_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/concept/created_on", | ||
"type": "string", | ||
"format": "datetimezone" | ||
}, | ||
"status": { | ||
"id": "/concept/status", | ||
"type": "boolean" | ||
}, | ||
"updated_on": { | ||
"id": "/concept/updated_on", | ||
"type": "string", | ||
"format": "datetimezone" | ||
} | ||
}, | ||
"required": [ | ||
"advertiser_id", | ||
"name" | ||
] | ||
concept: { | ||
id: '/concept', | ||
type: 'object', | ||
properties: { | ||
advertiser_id: { | ||
id: '/concept/advertiser_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/concept/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
status: { | ||
id: '/concept/status', | ||
type: 'boolean', | ||
}, | ||
updated_on: { | ||
id: '/concept/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/concept" | ||
} | ||
] | ||
required: [ | ||
'advertiser_id', | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/concept', | ||
}, | ||
], | ||
}; |
module.exports = { | ||
"id": "/container_single", | ||
"type": "object", | ||
"properties": { | ||
"data": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "atomic_creative.json#/atomic_creative" | ||
}, | ||
{ | ||
"$ref": "agency.json#/agency" | ||
} | ||
] | ||
} | ||
id: '/container_single', | ||
type: 'object', | ||
properties: { | ||
data: { | ||
oneOf: [ | ||
{ | ||
$ref: 'atomic_creative.json#/atomic_creative', | ||
}, | ||
{ | ||
$ref: 'agency.json#/agency', | ||
}, | ||
], | ||
}, | ||
}, | ||
"required": [ | ||
"data", | ||
"meta" | ||
] | ||
required: [ | ||
'data', | ||
'meta', | ||
], | ||
}; |
@@ -1,64 +0,64 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"creative_approval": { | ||
"id": "/creative_approval", | ||
"type": "object", | ||
"properties": { | ||
"additional_detail": { | ||
"id": "/creative_approval/additional_detail", | ||
"type": "integer", | ||
"readonly": true | ||
}, | ||
"approval_status": { | ||
"id": "/creative_approval/approval_status", | ||
"type": "integer", | ||
"readonly": true | ||
}, | ||
"atomic_creative_approval_id": { | ||
"id": "/creative_approval/atomic_creative_id", | ||
"type": "integer", | ||
"readonly": true | ||
}, | ||
"creative_import_file_id": { | ||
"id": "/creative_approval/creative_import_file_id", | ||
"type": "integer", | ||
"readonly": true | ||
}, | ||
"external_identifier": { | ||
"id": "/creative_approval/external_identifier", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"rejected_reason": { | ||
"id": "/creative_approval/rejected_reason", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"supply_source_id": { | ||
"id": "/creative_approval/supply_source_id", | ||
"type": "integer", | ||
"readonly": true | ||
}, | ||
"created_on": { | ||
"id": "/creative_approval/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/creative_approval/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [] | ||
creative_approval: { | ||
id: '/creative_approval', | ||
type: 'object', | ||
properties: { | ||
additional_detail: { | ||
id: '/creative_approval/additional_detail', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
approval_status: { | ||
id: '/creative_approval/approval_status', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
atomic_creative_approval_id: { | ||
id: '/creative_approval/atomic_creative_id', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
creative_import_file_id: { | ||
id: '/creative_approval/creative_import_file_id', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
external_identifier: { | ||
id: '/creative_approval/external_identifier', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
rejected_reason: { | ||
id: '/creative_approval/rejected_reason', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
supply_source_id: { | ||
id: '/creative_approval/supply_source_id', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
created_on: { | ||
id: '/creative_approval/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/creative_approval/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/creative_approval" | ||
} | ||
] | ||
required: [], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/creative_approval', | ||
}, | ||
], | ||
}; |
@@ -1,40 +0,40 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"creative": { | ||
"id": "/creative", | ||
"type": "object", | ||
"properties": { | ||
"atomic_creative_id": { | ||
"id": "/creative/atomic_creative_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/creative/created_on", | ||
"type": "string" | ||
}, | ||
"last_modified": { | ||
"id": "/creative/last_modified", | ||
"type": "string" | ||
}, | ||
"tag": { | ||
"id": "/creative/tag", | ||
"type": "string" | ||
}, | ||
"tag_type": { | ||
"id": "/creative/tag_type", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"advertiser_id", | ||
"name" | ||
] | ||
creative: { | ||
id: '/creative', | ||
type: 'object', | ||
properties: { | ||
atomic_creative_id: { | ||
id: '/creative/atomic_creative_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/creative/created_on', | ||
type: 'string', | ||
}, | ||
last_modified: { | ||
id: '/creative/last_modified', | ||
type: 'string', | ||
}, | ||
tag: { | ||
id: '/creative/tag', | ||
type: 'string', | ||
}, | ||
tag_type: { | ||
id: '/creative/tag_type', | ||
type: 'string', | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/creative" | ||
} | ||
] | ||
required: [ | ||
'advertiser_id', | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/creative', | ||
}, | ||
], | ||
}; |
@@ -1,150 +0,150 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"deal": { | ||
"id": "/deal", | ||
"type": "object", | ||
"properties": { | ||
"end_datetime": { | ||
"id": "/deal/end_datetime", | ||
"type": "string", | ||
"format": "datetime" | ||
deal: { | ||
id: '/deal', | ||
type: 'object', | ||
properties: { | ||
end_datetime: { | ||
id: '/deal/end_datetime', | ||
type: 'string', | ||
format: 'datetime', | ||
}, | ||
deal_identifier: { | ||
id: '/deal/deal_identifier', | ||
type: 'string', | ||
}, | ||
description: { | ||
id: '/deal/description', | ||
type: ['string', 'null'], | ||
}, | ||
start_datetime: { | ||
id: '/deal/start_datetime', | ||
type: 'string', | ||
format: 'datetime', | ||
}, | ||
permissions: { | ||
type: 'object', | ||
properties: { | ||
all_organizations: { | ||
id: '/deal/permissions/all_organizations', | ||
type: 'boolean', | ||
}, | ||
agency_ids: { | ||
id: '/deal/permissions/agency_ids', | ||
type: 'array', | ||
items: { | ||
type: 'integer', | ||
}, | ||
"deal_identifier": { | ||
"id": "/deal/deal_identifier", | ||
"type": "string" | ||
minItems: 0, | ||
uniqueItems: true, | ||
}, | ||
organization_ids: { | ||
id: '/deal/permissions/organization_ids', | ||
type: 'array', | ||
items: { | ||
type: 'integer', | ||
}, | ||
"description": { | ||
"id": "/deal/description", | ||
"type": ["string", "null"] | ||
minItems: 0, | ||
uniqueItems: true, | ||
}, | ||
advertiser_ids: { | ||
id: '/deal/permissions/advertiser_ids', | ||
type: 'array', | ||
items: { | ||
type: 'integer', | ||
}, | ||
"start_datetime": { | ||
"id": "/deal/start_datetime", | ||
"type": "string", | ||
"format": "datetime" | ||
}, | ||
"permissions": { | ||
"type": "object", | ||
"properties": { | ||
"all_organizations": { | ||
"id": "/deal/permissions/all_organizations", | ||
"type": "boolean" | ||
}, | ||
"agency_ids": { | ||
"id": "/deal/permissions/agency_ids", | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
}, | ||
"minItems": 0, | ||
"uniqueItems": true | ||
}, | ||
"organization_ids": { | ||
"id": "/deal/permissions/organization_ids", | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
}, | ||
"minItems": 0, | ||
"uniqueItems": true | ||
}, | ||
"advertiser_ids": { | ||
"id": "/deal/permissions/advertiser_ids", | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
}, | ||
"minItems": 0, | ||
"uniqueItems": true | ||
} | ||
} | ||
}, | ||
"owner": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"id": "/deal/owner/type", | ||
"enum": [ | ||
"INTERNAL", | ||
"ORGANIZATION", | ||
"AGENCY", | ||
"ADVERTISER" | ||
] | ||
}, | ||
"id": { | ||
"id": "/deal/price/id", | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"price": { | ||
"type": "object", | ||
"properties": { | ||
"value": { | ||
"id": "/deal/price/value", | ||
"type": "string", | ||
"pattern": "[0-9]+(\.[0-9]+)?" | ||
}, | ||
"currency_code": { | ||
"id": "/deal/price/currency_code", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"price_method": { | ||
"id": "/deal/price_method", | ||
"enum": [ | ||
"CPM" | ||
], | ||
"default": "CPM" | ||
}, | ||
"price_type": { | ||
"id": "/deal/price_type", | ||
"enum": [ | ||
"FIXED", | ||
"FLOOR" | ||
] | ||
}, | ||
"status": { | ||
"id": "/deal/status", | ||
"type": "boolean" | ||
}, | ||
"supply_source_id": { | ||
"id": "/deal/supply_source_id", | ||
"type": ["integer", "null"] | ||
}, | ||
"sub_supply_source_id": { | ||
"id": "/deal/sub_supply_source_id", | ||
"type": ["integer", "null"] | ||
}, | ||
"created_on": { | ||
"id": "/deal/created_on", | ||
"type": "string", | ||
"format": "datetime" | ||
}, | ||
"updated_on": { | ||
"id": "/deal/updated_on", | ||
"type": "string", | ||
"format": "datetime" | ||
} | ||
minItems: 0, | ||
uniqueItems: true, | ||
}, | ||
}, | ||
"required": [ | ||
"start_datetime", | ||
"end_datetime", | ||
"deal_identifier", | ||
"name", | ||
"owner", | ||
"permissions", | ||
"price", | ||
"price_method", | ||
"price_type", | ||
"status" | ||
] | ||
}, | ||
owner: { | ||
type: 'object', | ||
properties: { | ||
type: { | ||
id: '/deal/owner/type', | ||
enum: [ | ||
'INTERNAL', | ||
'ORGANIZATION', | ||
'AGENCY', | ||
'ADVERTISER', | ||
], | ||
}, | ||
id: { | ||
id: '/deal/price/id', | ||
type: 'integer', | ||
}, | ||
}, | ||
}, | ||
price: { | ||
type: 'object', | ||
properties: { | ||
value: { | ||
id: '/deal/price/value', | ||
type: 'string', | ||
pattern: '[0-9]+(\\.[0-9]+)?', | ||
}, | ||
currency_code: { | ||
id: '/deal/price/currency_code', | ||
type: 'string', | ||
}, | ||
}, | ||
}, | ||
price_method: { | ||
id: '/deal/price_method', | ||
enum: [ | ||
'CPM', | ||
], | ||
default: 'CPM', | ||
}, | ||
price_type: { | ||
id: '/deal/price_type', | ||
enum: [ | ||
'FIXED', | ||
'FLOOR', | ||
], | ||
}, | ||
status: { | ||
id: '/deal/status', | ||
type: 'boolean', | ||
}, | ||
supply_source_id: { | ||
id: '/deal/supply_source_id', | ||
type: ['integer', 'null'], | ||
}, | ||
sub_supply_source_id: { | ||
id: '/deal/sub_supply_source_id', | ||
type: ['integer', 'null'], | ||
}, | ||
created_on: { | ||
id: '/deal/created_on', | ||
type: 'string', | ||
format: 'datetime', | ||
}, | ||
updated_on: { | ||
id: '/deal/updated_on', | ||
type: 'string', | ||
format: 'datetime', | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/deal" | ||
} | ||
] | ||
required: [ | ||
'start_datetime', | ||
'end_datetime', | ||
'deal_identifier', | ||
'name', | ||
'owner', | ||
'permissions', | ||
'price', | ||
'price_method', | ||
'price_type', | ||
'status', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/deal', | ||
}, | ||
], | ||
}; |
@@ -1,102 +0,102 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"organization": { | ||
"id": "/organization", | ||
"type": "object", | ||
"properties": { | ||
"address_1": { | ||
"id": "/organization/address_1", | ||
"type": "string" | ||
}, | ||
"address_2": { | ||
"id": "/organization/address_2", | ||
"type": "string" | ||
}, | ||
"adx_seat_account_id": { | ||
"id": "/organization/adx_seat_account_id", | ||
"type": "integer" | ||
}, | ||
"allow_byo_price": { | ||
"id": "/organization/allow_byo_price", | ||
"type": "boolean" | ||
}, | ||
"allow_x_agency_pixels": { | ||
"id": "/organization/allow_x_agency_pixels", | ||
"type": "boolean" | ||
}, | ||
"city": { | ||
"id": "/organization/city", | ||
"type": "string" | ||
}, | ||
"contact_name": { | ||
"id": "/organization/contact_name", | ||
"type": "string" | ||
}, | ||
"country": { | ||
"id": "/organization/country", | ||
"type": "string" | ||
}, | ||
"currency_code": { | ||
"id": "/organization/currency_code", | ||
"type": "string" | ||
}, | ||
"mm_contact_name": { | ||
"id": "/organization/mm_contact_name", | ||
"type": "string" | ||
}, | ||
"phone": { | ||
"id": "/organization/phone", | ||
"type": "string" | ||
}, | ||
"state": { | ||
"id": "/organization/state", | ||
"type": "string" | ||
}, | ||
"status": { | ||
"id": "/organization/status", | ||
"type": "boolean" | ||
}, | ||
"tag_ruleset": { | ||
"id": "/organization/tag_ruleset", | ||
"type": "string" | ||
}, | ||
"use_evidon_optout": { | ||
"id": "/organization/use_evidon_optout", | ||
"type": "boolean" | ||
}, | ||
"zip": { | ||
"id": "/organization/zip", | ||
"type": "string" | ||
}, | ||
"created_on": { | ||
"id": "/organization/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/organization/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"address_1", | ||
"city", | ||
"contact_name", | ||
"mm_contact_name", | ||
"name", | ||
"phone", | ||
"state", | ||
"zip" | ||
] | ||
organization: { | ||
id: '/organization', | ||
type: 'object', | ||
properties: { | ||
address_1: { | ||
id: '/organization/address_1', | ||
type: 'string', | ||
}, | ||
address_2: { | ||
id: '/organization/address_2', | ||
type: 'string', | ||
}, | ||
adx_seat_account_id: { | ||
id: '/organization/adx_seat_account_id', | ||
type: 'integer', | ||
}, | ||
allow_byo_price: { | ||
id: '/organization/allow_byo_price', | ||
type: 'boolean', | ||
}, | ||
allow_x_agency_pixels: { | ||
id: '/organization/allow_x_agency_pixels', | ||
type: 'boolean', | ||
}, | ||
city: { | ||
id: '/organization/city', | ||
type: 'string', | ||
}, | ||
contact_name: { | ||
id: '/organization/contact_name', | ||
type: 'string', | ||
}, | ||
country: { | ||
id: '/organization/country', | ||
type: 'string', | ||
}, | ||
currency_code: { | ||
id: '/organization/currency_code', | ||
type: 'string', | ||
}, | ||
mm_contact_name: { | ||
id: '/organization/mm_contact_name', | ||
type: 'string', | ||
}, | ||
phone: { | ||
id: '/organization/phone', | ||
type: 'string', | ||
}, | ||
state: { | ||
id: '/organization/state', | ||
type: 'string', | ||
}, | ||
status: { | ||
id: '/organization/status', | ||
type: 'boolean', | ||
}, | ||
tag_ruleset: { | ||
id: '/organization/tag_ruleset', | ||
type: 'string', | ||
}, | ||
use_evidon_optout: { | ||
id: '/organization/use_evidon_optout', | ||
type: 'boolean', | ||
}, | ||
zip: { | ||
id: '/organization/zip', | ||
type: 'string', | ||
}, | ||
created_on: { | ||
id: '/organization/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/organization/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/organization" | ||
} | ||
] | ||
required: [ | ||
'address_1', | ||
'city', | ||
'contact_name', | ||
'mm_contact_name', | ||
'name', | ||
'phone', | ||
'state', | ||
'zip', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/organization', | ||
}, | ||
], | ||
}; |
@@ -1,142 +0,142 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"pixel_bundle": { | ||
"id": "/pixel_bundle", | ||
"type": "object", | ||
"properties": { | ||
"advertiser_id": { | ||
"id": "/pixel_bundle/advertiser_id", | ||
"type": "integer" | ||
}, | ||
"agency_id": { | ||
"id": "/pixel_bundle/agency_id", | ||
"type": "integer" | ||
}, | ||
"cost_cpm": { | ||
"id": "/pixel_bundle/cost_cpm", | ||
"type": "number" | ||
}, | ||
"cost_cpts": { | ||
"id": "/pixel_bundle/cost_cpts", | ||
"type": "number" | ||
}, | ||
"cost_pct_cpm": { | ||
"id": "/pixel_bundle/cost_pct_cpm", | ||
"type": "number" | ||
}, | ||
"eligible": { | ||
"id": "/pixel_bundle/eligible", | ||
"type": "boolean" | ||
}, | ||
"external_identifier": { | ||
"id": "/pixel_bundle/external_identifier", | ||
"type": "string" | ||
}, | ||
"keywords": { | ||
"id": "/pixel_bundle/keywords", | ||
"type": "string" | ||
}, | ||
"pixel_type": { | ||
"id": "/pixel_bundle/pixel_type", | ||
"enum": [ | ||
"creative", | ||
"event", | ||
"data", | ||
"segment" | ||
], | ||
"default": "event" | ||
}, | ||
"pricing": { | ||
"id": "/pixel_bundle/pricing", | ||
"enum": [ | ||
"CPM", | ||
"CPTS" | ||
], | ||
"default": "CPM" | ||
}, | ||
"provider_id": { | ||
"id": "/pixel_bundle/provider_id", | ||
"type": "integer" | ||
}, | ||
"rmx_conversion_minutes": { | ||
"id": "/pixel_bundle/rmx_conversion_minutes", | ||
"type": "integer" | ||
}, | ||
"rmx_conversion_type": { | ||
"id": "/pixel_bundle/rmx_conversion_type", | ||
"enum": [ | ||
"one", | ||
"variable" | ||
], | ||
"default": "one" | ||
}, | ||
"rmx_friendly": { | ||
"id": "/pixel_bundle/rmx_friendly", | ||
"type": "boolean" | ||
}, | ||
"rmx_merit": { | ||
"id": "/pixel_bundle/rmx_merit", | ||
"type": "boolean" | ||
}, | ||
"rmx_pc_window_minutes": { | ||
"id": "/pixel_bundle/rmx_pc_window_minutes", | ||
"type": "integer" | ||
}, | ||
"rmx_pv_window_minutes": { | ||
"id": "/pixel_bundle/rmx_pv_window_minutes", | ||
"type": "integer" | ||
}, | ||
"segment_op": { | ||
"id": "/pixel_bundle/segment_op", | ||
"type": "string" | ||
}, | ||
"status": { | ||
"id": "/pixel_bundle/status", | ||
"type": "boolean" | ||
}, | ||
"tag_type": { | ||
"id": "/pixel_bundle/tag_type", | ||
"enum": [ | ||
"dfa", | ||
"uat", | ||
"image", | ||
"iframe", | ||
"js" | ||
], | ||
"default": "image" | ||
}, | ||
"tags": { | ||
"id": "/pixel_bundle/tags", | ||
"type": "string" | ||
}, | ||
"type": { | ||
"id": "/pixel_bundle/type", | ||
"type": "string" | ||
}, | ||
"created_on": { | ||
"id": "/pixel_bundle/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/pixel_bundle/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"pixel_type", | ||
"tag_type" | ||
] | ||
pixel_bundle: { | ||
id: '/pixel_bundle', | ||
type: 'object', | ||
properties: { | ||
advertiser_id: { | ||
id: '/pixel_bundle/advertiser_id', | ||
type: 'integer', | ||
}, | ||
agency_id: { | ||
id: '/pixel_bundle/agency_id', | ||
type: 'integer', | ||
}, | ||
cost_cpm: { | ||
id: '/pixel_bundle/cost_cpm', | ||
type: 'number', | ||
}, | ||
cost_cpts: { | ||
id: '/pixel_bundle/cost_cpts', | ||
type: 'number', | ||
}, | ||
cost_pct_cpm: { | ||
id: '/pixel_bundle/cost_pct_cpm', | ||
type: 'number', | ||
}, | ||
eligible: { | ||
id: '/pixel_bundle/eligible', | ||
type: 'boolean', | ||
}, | ||
external_identifier: { | ||
id: '/pixel_bundle/external_identifier', | ||
type: 'string', | ||
}, | ||
keywords: { | ||
id: '/pixel_bundle/keywords', | ||
type: 'string', | ||
}, | ||
pixel_type: { | ||
id: '/pixel_bundle/pixel_type', | ||
enum: [ | ||
'creative', | ||
'event', | ||
'data', | ||
'segment', | ||
], | ||
default: 'event', | ||
}, | ||
pricing: { | ||
id: '/pixel_bundle/pricing', | ||
enum: [ | ||
'CPM', | ||
'CPTS', | ||
], | ||
default: 'CPM', | ||
}, | ||
provider_id: { | ||
id: '/pixel_bundle/provider_id', | ||
type: 'integer', | ||
}, | ||
rmx_conversion_minutes: { | ||
id: '/pixel_bundle/rmx_conversion_minutes', | ||
type: 'integer', | ||
}, | ||
rmx_conversion_type: { | ||
id: '/pixel_bundle/rmx_conversion_type', | ||
enum: [ | ||
'one', | ||
'variable', | ||
], | ||
default: 'one', | ||
}, | ||
rmx_friendly: { | ||
id: '/pixel_bundle/rmx_friendly', | ||
type: 'boolean', | ||
}, | ||
rmx_merit: { | ||
id: '/pixel_bundle/rmx_merit', | ||
type: 'boolean', | ||
}, | ||
rmx_pc_window_minutes: { | ||
id: '/pixel_bundle/rmx_pc_window_minutes', | ||
type: 'integer', | ||
}, | ||
rmx_pv_window_minutes: { | ||
id: '/pixel_bundle/rmx_pv_window_minutes', | ||
type: 'integer', | ||
}, | ||
segment_op: { | ||
id: '/pixel_bundle/segment_op', | ||
type: 'string', | ||
}, | ||
status: { | ||
id: '/pixel_bundle/status', | ||
type: 'boolean', | ||
}, | ||
tag_type: { | ||
id: '/pixel_bundle/tag_type', | ||
enum: [ | ||
'dfa', | ||
'uat', | ||
'image', | ||
'iframe', | ||
'js', | ||
], | ||
default: 'image', | ||
}, | ||
tags: { | ||
id: '/pixel_bundle/tags', | ||
type: 'string', | ||
}, | ||
type: { | ||
id: '/pixel_bundle/type', | ||
type: 'string', | ||
}, | ||
created_on: { | ||
id: '/pixel_bundle/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/pixel_bundle/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/pixel_bundle" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
'pixel_type', | ||
'tag_type', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/pixel_bundle', | ||
}, | ||
], | ||
}; |
@@ -1,56 +0,56 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"pixel_provider": { | ||
"id": "/pixel_provider", | ||
"type": "object", | ||
"properties": { | ||
"agency_id": { | ||
"id": "/pixel_provider/agency_id", | ||
"type": "integer" | ||
}, | ||
"execution_by": { | ||
"id": "/pixel_provider/execution_by", | ||
"enum": [ | ||
"MEDIAMATH", | ||
"UDI" | ||
], | ||
"default": "UDI" | ||
}, | ||
"status": { | ||
"id": "/pixel_provider/status", | ||
"type": "boolean" | ||
}, | ||
"taxonomy_file": { | ||
"id": "/pixel_provider/taxonomy_file", | ||
"type": "string" | ||
}, | ||
"vendor_id": { | ||
"id": "/pixel_provider/vendor_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/pixel_provider/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/pixel_provider/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"vendor_id" | ||
] | ||
pixel_provider: { | ||
id: '/pixel_provider', | ||
type: 'object', | ||
properties: { | ||
agency_id: { | ||
id: '/pixel_provider/agency_id', | ||
type: 'integer', | ||
}, | ||
execution_by: { | ||
id: '/pixel_provider/execution_by', | ||
enum: [ | ||
'MEDIAMATH', | ||
'UDI', | ||
], | ||
default: 'UDI', | ||
}, | ||
status: { | ||
id: '/pixel_provider/status', | ||
type: 'boolean', | ||
}, | ||
taxonomy_file: { | ||
id: '/pixel_provider/taxonomy_file', | ||
type: 'string', | ||
}, | ||
vendor_id: { | ||
id: '/pixel_provider/vendor_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/pixel_provider/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/pixel_provider/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/pixel_provider" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
'vendor_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/pixel_provider', | ||
}, | ||
], | ||
}; |
@@ -1,56 +0,56 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"pixel": { | ||
"id": "/pixel", | ||
"type": "object", | ||
"properties": { | ||
"bundle_id": { | ||
"id": "/pixel/bundle_id", | ||
"type": "integer" | ||
}, | ||
"distributed": { | ||
"id": "/pixel/distributed", | ||
"type": "boolean" | ||
}, | ||
"pixel_type": { | ||
"id": "/pixel/pixel_type", | ||
"enum": [ | ||
"USER", | ||
"INTERNAL" | ||
] | ||
}, | ||
"supply_source_id": { | ||
"id": "/pixel/supply_source_id", | ||
"type": "integer" | ||
}, | ||
"tag": { | ||
"id": "/pixel/tag", | ||
"type": "string" | ||
}, | ||
"created_on": { | ||
"id": "/pixel/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/pixel/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"bundle_id", | ||
"pixel_type", | ||
"tag" | ||
] | ||
pixel: { | ||
id: '/pixel', | ||
type: 'object', | ||
properties: { | ||
bundle_id: { | ||
id: '/pixel/bundle_id', | ||
type: 'integer', | ||
}, | ||
distributed: { | ||
id: '/pixel/distributed', | ||
type: 'boolean', | ||
}, | ||
pixel_type: { | ||
id: '/pixel/pixel_type', | ||
enum: [ | ||
'USER', | ||
'INTERNAL', | ||
], | ||
}, | ||
supply_source_id: { | ||
id: '/pixel/supply_source_id', | ||
type: 'integer', | ||
}, | ||
tag: { | ||
id: '/pixel/tag', | ||
type: 'string', | ||
}, | ||
created_on: { | ||
id: '/pixel/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/pixel/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/pixel" | ||
} | ||
] | ||
required: [ | ||
'bundle_id', | ||
'pixel_type', | ||
'tag', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/pixel', | ||
}, | ||
], | ||
}; |
@@ -1,150 +0,150 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"placement_slot": { | ||
"id": "/placement_slot", | ||
"type": "object", | ||
"properties": { | ||
"ad_slot": { | ||
"id": "/placement_slot/ad_slot", | ||
"type": "integer" | ||
}, | ||
"allow_remnant": { | ||
"id": "/placement_slot/allow_remnant", | ||
"type": "boolean" | ||
}, | ||
"auction_type": { | ||
"id": "/placement_slot/auction_type", | ||
"enum": [ | ||
"FIRST_PRICED", | ||
"SECOND_PRICED" | ||
], | ||
"default": "FIRST_PRICED" | ||
}, | ||
"budget": { | ||
"id": "/placement_slot/budget", | ||
"type": "number" | ||
}, | ||
"buy_price": { | ||
"id": "/placement_slot/buy_price", | ||
"type": "number" | ||
}, | ||
"buy_price_type": { | ||
"id": "/placement_slot/buy_price_type", | ||
"type": { | ||
"enum": [ | ||
"CPM" | ||
] | ||
}, | ||
"default": "CPM" | ||
}, | ||
"description": { | ||
"id": "/placement_slot/description", | ||
"type": "string" | ||
}, | ||
"end_date": { | ||
"id": "/placement_slot/end_date", | ||
"type": "string", | ||
"format": "datetimezone" | ||
}, | ||
"est_volume": { | ||
"id": "/placement_slot/est_volume", | ||
"type": "number" | ||
}, | ||
"frequency_amount": { | ||
"id": "/placement_slot/frequency_amount", | ||
"type": "integer" | ||
}, | ||
"frequency_interval": { | ||
"id": "/placement_slot/frequency_interval", | ||
"enum": [ | ||
"hour", | ||
"day", | ||
"week", | ||
"month", | ||
"campaign", | ||
"not-applicable" | ||
], | ||
"default": "not-applicable" | ||
}, | ||
"frequency_type": { | ||
"id": "/placement_slot/frequency_type", | ||
"enum": [ | ||
"even", | ||
"asap", | ||
"no-limit" | ||
], | ||
"default": "no-limit" | ||
}, | ||
"height": { | ||
"id": "/placement_slot/height", | ||
"type": "integer" | ||
}, | ||
"prm_pub_ceiling": { | ||
"id": "/placement_slot/prm_pub_ceiling", | ||
"type": "number" | ||
}, | ||
"prm_pub_markup": { | ||
"id": "/placement_slot/prm_pub_markup", | ||
"type": "number" | ||
}, | ||
"sell_price": { | ||
"id": "/placement_slot/sell_price", | ||
"type": "number" | ||
}, | ||
"sell_price_type": { | ||
"id": "/placement_slot/sell_price_type", | ||
"enum": [ | ||
"CPM" | ||
], | ||
"default": "CPM" | ||
}, | ||
"site_placement_id": { | ||
"id": "/placement_slot/site_placement_id", | ||
"type": "integer" | ||
}, | ||
"start_date": { | ||
"id": "/placement_slot/start_date", | ||
"type": "string", | ||
"format": "datetimezone" | ||
}, | ||
"volume_unit": { | ||
"id": "/placement_slot/volume_unit", | ||
"enum": [ | ||
"impressions" | ||
], | ||
"default": "impressions" | ||
}, | ||
"width": { | ||
"id": "/placement_slot/sell_price", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/placement_slot/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/placement_slot/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
placement_slot: { | ||
id: '/placement_slot', | ||
type: 'object', | ||
properties: { | ||
ad_slot: { | ||
id: '/placement_slot/ad_slot', | ||
type: 'integer', | ||
}, | ||
allow_remnant: { | ||
id: '/placement_slot/allow_remnant', | ||
type: 'boolean', | ||
}, | ||
auction_type: { | ||
id: '/placement_slot/auction_type', | ||
enum: [ | ||
'FIRST_PRICED', | ||
'SECOND_PRICED', | ||
], | ||
default: 'FIRST_PRICED', | ||
}, | ||
budget: { | ||
id: '/placement_slot/budget', | ||
type: 'number', | ||
}, | ||
buy_price: { | ||
id: '/placement_slot/buy_price', | ||
type: 'number', | ||
}, | ||
buy_price_type: { | ||
id: '/placement_slot/buy_price_type', | ||
type: { | ||
enum: [ | ||
'CPM', | ||
], | ||
}, | ||
"required": [ | ||
"auction_type", | ||
"buy_price", | ||
"buy_price_type", | ||
"height", | ||
"site_placement_id", | ||
"width" | ||
] | ||
default: 'CPM', | ||
}, | ||
description: { | ||
id: '/placement_slot/description', | ||
type: 'string', | ||
}, | ||
end_date: { | ||
id: '/placement_slot/end_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
est_volume: { | ||
id: '/placement_slot/est_volume', | ||
type: 'number', | ||
}, | ||
frequency_amount: { | ||
id: '/placement_slot/frequency_amount', | ||
type: 'integer', | ||
}, | ||
frequency_interval: { | ||
id: '/placement_slot/frequency_interval', | ||
enum: [ | ||
'hour', | ||
'day', | ||
'week', | ||
'month', | ||
'campaign', | ||
'not-applicable', | ||
], | ||
default: 'not-applicable', | ||
}, | ||
frequency_type: { | ||
id: '/placement_slot/frequency_type', | ||
enum: [ | ||
'even', | ||
'asap', | ||
'no-limit', | ||
], | ||
default: 'no-limit', | ||
}, | ||
height: { | ||
id: '/placement_slot/height', | ||
type: 'integer', | ||
}, | ||
prm_pub_ceiling: { | ||
id: '/placement_slot/prm_pub_ceiling', | ||
type: 'number', | ||
}, | ||
prm_pub_markup: { | ||
id: '/placement_slot/prm_pub_markup', | ||
type: 'number', | ||
}, | ||
sell_price: { | ||
id: '/placement_slot/sell_price', | ||
type: 'number', | ||
}, | ||
sell_price_type: { | ||
id: '/placement_slot/sell_price_type', | ||
enum: [ | ||
'CPM', | ||
], | ||
default: 'CPM', | ||
}, | ||
site_placement_id: { | ||
id: '/placement_slot/site_placement_id', | ||
type: 'integer', | ||
}, | ||
start_date: { | ||
id: '/placement_slot/start_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
volume_unit: { | ||
id: '/placement_slot/volume_unit', | ||
enum: [ | ||
'impressions', | ||
], | ||
default: 'impressions', | ||
}, | ||
width: { | ||
id: '/placement_slot/sell_price', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/placement_slot/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/placement_slot/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/placement_slot" | ||
} | ||
] | ||
required: [ | ||
'auction_type', | ||
'buy_price', | ||
'buy_price_type', | ||
'height', | ||
'site_placement_id', | ||
'width', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/placement_slot', | ||
}, | ||
], | ||
}; |
@@ -1,36 +0,36 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"publisher_site": { | ||
"id": "/publisher_site", | ||
"type": "object", | ||
"properties": { | ||
"publisher_id": { | ||
"id": "/publisher_site/publisher_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/publisher_site/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/publisher_site/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"publisher_id" | ||
] | ||
publisher_site: { | ||
id: '/publisher_site', | ||
type: 'object', | ||
properties: { | ||
publisher_id: { | ||
id: '/publisher_site/publisher_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/publisher_site/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/publisher_site/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/publisher_site" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
'publisher_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/publisher_site', | ||
}, | ||
], | ||
}; |
@@ -1,35 +0,35 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"publisher": { | ||
"id": "/publisher", | ||
"type": "object", | ||
"properties": { | ||
"organization_id": { | ||
"id": "/publisher/organization_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/publisher/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/publisher/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
publisher: { | ||
id: '/publisher', | ||
type: 'object', | ||
properties: { | ||
organization_id: { | ||
id: '/publisher/organization_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/publisher/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/publisher/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/publisher" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/publisher', | ||
}, | ||
], | ||
}; |
@@ -1,60 +0,60 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"site_list": { | ||
"id": "/site_list", | ||
"type": "object", | ||
"properties": { | ||
"organization_id": { | ||
"id": "/site_list/organization_id", | ||
"type": "integer" | ||
}, | ||
"sites_count": { | ||
"id": "/site_list/sites_count", | ||
"type": "integer" | ||
}, | ||
"sites_count_domain": { | ||
"id": "/site_list/sites_count_domain", | ||
"type": "integer" | ||
}, | ||
"status": { | ||
"id": "/site_list/status", | ||
"type": "boolean" | ||
}, | ||
"filename": { | ||
"id": "/site_list/filename", | ||
"type": "string" | ||
}, | ||
"restriction": { | ||
"id": "/site_list/restriction", | ||
"enum": [ | ||
"INCLUDE", | ||
"EXCLUDE" | ||
], | ||
"default": "EXCLUDE" | ||
}, | ||
"created_on": { | ||
"id": "/site_list/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/site_list/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"organization_id" | ||
] | ||
site_list: { | ||
id: '/site_list', | ||
type: 'object', | ||
properties: { | ||
organization_id: { | ||
id: '/site_list/organization_id', | ||
type: 'integer', | ||
}, | ||
sites_count: { | ||
id: '/site_list/sites_count', | ||
type: 'integer', | ||
}, | ||
sites_count_domain: { | ||
id: '/site_list/sites_count_domain', | ||
type: 'integer', | ||
}, | ||
status: { | ||
id: '/site_list/status', | ||
type: 'boolean', | ||
}, | ||
filename: { | ||
id: '/site_list/filename', | ||
type: 'string', | ||
}, | ||
restriction: { | ||
id: '/site_list/restriction', | ||
enum: [ | ||
'INCLUDE', | ||
'EXCLUDE', | ||
], | ||
default: 'EXCLUDE', | ||
}, | ||
created_on: { | ||
id: '/site_list/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/site_list/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/site_list" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
'organization_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/site_list', | ||
}, | ||
], | ||
}; |
@@ -1,69 +0,69 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"site_placement": { | ||
"id": "/site_placement", | ||
"type": "object", | ||
"properties": { | ||
"display_text": { | ||
"id": "/site_placement/display_text", | ||
"type": "string" | ||
}, | ||
"bill_media_to_client": { | ||
"id": "/site_placement/bill_media_to_client", | ||
"type": "boolean" | ||
}, | ||
"pmp_type": { | ||
"id": "/site_placement/pmp_type", | ||
"enum": [ | ||
"DIRECT", | ||
"PREMIUM" | ||
], | ||
"default": "DIRECT" | ||
}, | ||
"publisher_site_id": { | ||
"id": "/site_placement/publisher_site_id", | ||
"type": "integer" | ||
}, | ||
"media_type": { | ||
"id": "/site_placement/media_type", | ||
"enum": [ | ||
"display", | ||
"video", | ||
"mobile" | ||
], | ||
"default": "display" | ||
}, | ||
"deal_source": { | ||
"id": "/site_placement/deal_source", | ||
"enum": [ | ||
"USER", | ||
"INTERNAL" | ||
], | ||
"default": "USER" | ||
}, | ||
"created_on": { | ||
"id": "/site_placement/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/site_placement/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"publisher_site_id" | ||
] | ||
site_placement: { | ||
id: '/site_placement', | ||
type: 'object', | ||
properties: { | ||
display_text: { | ||
id: '/site_placement/display_text', | ||
type: 'string', | ||
}, | ||
bill_media_to_client: { | ||
id: '/site_placement/bill_media_to_client', | ||
type: 'boolean', | ||
}, | ||
pmp_type: { | ||
id: '/site_placement/pmp_type', | ||
enum: [ | ||
'DIRECT', | ||
'PREMIUM', | ||
], | ||
default: 'DIRECT', | ||
}, | ||
publisher_site_id: { | ||
id: '/site_placement/publisher_site_id', | ||
type: 'integer', | ||
}, | ||
media_type: { | ||
id: '/site_placement/media_type', | ||
enum: [ | ||
'display', | ||
'video', | ||
'mobile', | ||
], | ||
default: 'display', | ||
}, | ||
deal_source: { | ||
id: '/site_placement/deal_source', | ||
enum: [ | ||
'USER', | ||
'INTERNAL', | ||
], | ||
default: 'USER', | ||
}, | ||
created_on: { | ||
id: '/site_placement/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/site_placement/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/site_placement" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
'publisher_site_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/site_placement', | ||
}, | ||
], | ||
}; |
module.exports = { | ||
"definitions": { | ||
"segment_array": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
definitions: { | ||
segment_array: { | ||
type: 'array', | ||
items: { | ||
type: 'integer', | ||
}, | ||
"minItems": 0, | ||
"uniqueItems": true | ||
} | ||
minItems: 0, | ||
uniqueItems: true, | ||
}, | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"include": { | ||
"$ref": "#/definitions/segment_array" | ||
type: 'object', | ||
properties: { | ||
include: { | ||
$ref: '#/definitions/segment_array', | ||
}, | ||
"include_op": { | ||
"enum": [ | ||
"OR", | ||
"AND" | ||
] | ||
include_op: { | ||
enum: [ | ||
'OR', | ||
'AND', | ||
], | ||
}, | ||
"exclude_op": { | ||
"enum": [ | ||
"OR", | ||
"AND" | ||
] | ||
} | ||
exclude_op: { | ||
enum: [ | ||
'OR', | ||
'AND', | ||
], | ||
}, | ||
}, | ||
"required": [ | ||
"include_op", | ||
"exclude_op" | ||
] | ||
required: [ | ||
'include_op', | ||
'exclude_op', | ||
], | ||
}; |
@@ -1,57 +0,57 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"strategy_audience_segment": { | ||
"id": "/strategy_audience_segment", | ||
"type": "object", | ||
"properties": { | ||
"strategy_id": { | ||
"id": "/strategy_audience_segment/strategy_id", | ||
"type": "integer" | ||
strategy_audience_segment: { | ||
id: '/strategy_audience_segment', | ||
type: 'object', | ||
properties: { | ||
strategy_id: { | ||
id: '/strategy_audience_segment/strategy_id', | ||
type: 'integer', | ||
}, | ||
"user_cpm": { | ||
"id": "/strategy_audience_segment/user_cpm", | ||
"type": "number" | ||
user_cpm: { | ||
id: '/strategy_audience_segment/user_cpm', | ||
type: 'number', | ||
}, | ||
"audience_segment_id": { | ||
"id": "/strategy_audience_segment/audience_segment_id", | ||
"type": "integer" | ||
audience_segment_id: { | ||
id: '/strategy_audience_segment/audience_segment_id', | ||
type: 'integer', | ||
}, | ||
"group_identifier": { | ||
"id": "/strategy_audience_segment/group_identifier", | ||
"type": "string" | ||
group_identifier: { | ||
id: '/strategy_audience_segment/group_identifier', | ||
type: 'string', | ||
}, | ||
"restriction": { | ||
"id": "/strategy_audience_segment/restriction", | ||
"type": { | ||
"enum": [ | ||
"INCLUDE", | ||
"EXCLUDE" | ||
] | ||
} | ||
restriction: { | ||
id: '/strategy_audience_segment/restriction', | ||
type: { | ||
enum: [ | ||
'INCLUDE', | ||
'EXCLUDE', | ||
], | ||
}, | ||
}, | ||
"created_on": { | ||
"id": "/strategy_audience_segment/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
created_on: { | ||
id: '/strategy_audience_segment/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
"updated_on": { | ||
"id": "/strategy_audience_segment/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
updated_on: { | ||
id: '/strategy_audience_segment/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"required": [ | ||
"name", | ||
"organization_id" | ||
] | ||
required: [ | ||
'name', | ||
'organization_id', | ||
], | ||
}, | ||
"allOf": [ | ||
allOf: [ | ||
common.entity, | ||
{ | ||
"$ref": "#/strategy_audience_segment" | ||
} | ||
] | ||
$ref: '#/strategy_audience_segment', | ||
}, | ||
], | ||
}; |
@@ -1,47 +0,47 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"strategy_concept": { | ||
"id": "/strategy_concept", | ||
"type": "object", | ||
"properties": { | ||
"concept_id": { | ||
"id": "/strategy_concept/concept_id", | ||
"type": "integer" | ||
}, | ||
"status": { | ||
"id": "/strategy_concept/status", | ||
"type": "boolean" | ||
}, | ||
"strategy_id": { | ||
"id": "/strategy_concept/concept_id", | ||
"type": "integer" | ||
}, | ||
"weighting": { | ||
"id": "/strategy_concept/weighting", | ||
"type": "string" | ||
}, | ||
"created_on": { | ||
"id": "/strategy_concept/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/strategy_concept/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
strategy_concept: { | ||
id: '/strategy_concept', | ||
type: 'object', | ||
properties: { | ||
concept_id: { | ||
id: '/strategy_concept/concept_id', | ||
type: 'integer', | ||
}, | ||
status: { | ||
id: '/strategy_concept/status', | ||
type: 'boolean', | ||
}, | ||
strategy_id: { | ||
id: '/strategy_concept/concept_id', | ||
type: 'integer', | ||
}, | ||
weighting: { | ||
id: '/strategy_concept/weighting', | ||
type: 'string', | ||
}, | ||
created_on: { | ||
id: '/strategy_concept/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/strategy_concept/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/strategy_concept" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/strategy_concept', | ||
}, | ||
], | ||
}; |
@@ -1,55 +0,55 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"strategy_day_part": { | ||
"id": "/strategy_day_part", | ||
"type": "object", | ||
"properties": { | ||
"days": { | ||
"id": "/strategy_day_part/days", | ||
"type": "string" | ||
}, | ||
"end_hour": { | ||
"id": "/strategy_day_part/end_hour", | ||
"type": "integer" | ||
}, | ||
"start_hour": { | ||
"id": "/strategy_day_part/start_hour", | ||
"type": "integer" | ||
}, | ||
"status": { | ||
"id": "/strategy_day_part/status", | ||
"type": "boolean" | ||
}, | ||
"strategy_id": { | ||
"id": "/strategy_day_part/strategy_id", | ||
"type": "integer" | ||
}, | ||
"user_time": { | ||
"id": "/strategy_day_part/user_time", | ||
"type": "boolean" | ||
}, | ||
"created_on": { | ||
"id": "/strategy_day_part/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/strategy_day_part/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
strategy_day_part: { | ||
id: '/strategy_day_part', | ||
type: 'object', | ||
properties: { | ||
days: { | ||
id: '/strategy_day_part/days', | ||
type: 'string', | ||
}, | ||
end_hour: { | ||
id: '/strategy_day_part/end_hour', | ||
type: 'integer', | ||
}, | ||
start_hour: { | ||
id: '/strategy_day_part/start_hour', | ||
type: 'integer', | ||
}, | ||
status: { | ||
id: '/strategy_day_part/status', | ||
type: 'boolean', | ||
}, | ||
strategy_id: { | ||
id: '/strategy_day_part/strategy_id', | ||
type: 'integer', | ||
}, | ||
user_time: { | ||
id: '/strategy_day_part/user_time', | ||
type: 'boolean', | ||
}, | ||
created_on: { | ||
id: '/strategy_day_part/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/strategy_day_part/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/strategy_day_part" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/strategy_day_part', | ||
}, | ||
], | ||
}; |
@@ -1,43 +0,43 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"strategy_domain": { | ||
"id": "/strategy_domain", | ||
"type": "object", | ||
"properties": { | ||
"domain": { | ||
"id": "/strategy_domain/domain", | ||
"type": "string" | ||
}, | ||
"restriction": { | ||
"id": "/strategy_domain/restriction", | ||
"type": "string" | ||
}, | ||
"strategy_id": { | ||
"id": "/strategy_domain/strategy_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/strategy_domain/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/strategy_domain/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
strategy_domain: { | ||
id: '/strategy_domain', | ||
type: 'object', | ||
properties: { | ||
domain: { | ||
id: '/strategy_domain/domain', | ||
type: 'string', | ||
}, | ||
restriction: { | ||
id: '/strategy_domain/restriction', | ||
type: 'string', | ||
}, | ||
strategy_id: { | ||
id: '/strategy_domain/strategy_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/strategy_domain/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/strategy_domain/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/strategy_domain" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/strategy_domain', | ||
}, | ||
], | ||
}; |
@@ -1,28 +0,28 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"strategy_domain": { | ||
"id": "/strategy_domain", | ||
"type": "object", | ||
"properties": { | ||
"strategy_id": { | ||
"id": "/strategy_domain/concept_id", | ||
"type": "integer" | ||
}, | ||
"supply_source_id": { | ||
"id": "/strategy_domain/supply_source_id", | ||
"type": "integer" | ||
} | ||
}, | ||
"required": [ | ||
"strategy_id", | ||
"supply_source_id" | ||
] | ||
strategy_domain: { | ||
id: '/strategy_domain', | ||
type: 'object', | ||
properties: { | ||
strategy_id: { | ||
id: '/strategy_domain/concept_id', | ||
type: 'integer', | ||
}, | ||
supply_source_id: { | ||
id: '/strategy_domain/supply_source_id', | ||
type: 'integer', | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/strategy_domain" | ||
} | ||
] | ||
required: [ | ||
'strategy_id', | ||
'supply_source_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/strategy_domain', | ||
}, | ||
], | ||
}; |
module.exports = { | ||
"definitions": { | ||
"target_value": { | ||
"type": "object", | ||
"properties": { | ||
"code": { | ||
"type": "string", | ||
"format": "[A-Z]{4}" | ||
}, | ||
"value_ids": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
}, | ||
"restriction": { | ||
"enum": [ | ||
"INCLUDE", | ||
"EXCLUDE" | ||
] | ||
}, | ||
"operation": { | ||
"enum": [ | ||
"OR", | ||
"AND" | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"code", | ||
"value_ids", | ||
"restriction", | ||
"operation" | ||
] | ||
} | ||
definitions: { | ||
target_value: { | ||
type: 'object', | ||
properties: { | ||
code: { | ||
type: 'string', | ||
format: '[A-Z]{4}', | ||
}, | ||
value_ids: { | ||
type: 'array', | ||
items: { | ||
type: 'integer', | ||
}, | ||
minItems: 1, | ||
uniqueItems: true, | ||
}, | ||
restriction: { | ||
enum: [ | ||
'INCLUDE', | ||
'EXCLUDE', | ||
], | ||
}, | ||
operation: { | ||
enum: [ | ||
'OR', | ||
'AND', | ||
], | ||
}, | ||
}, | ||
required: [ | ||
'code', | ||
'value_ids', | ||
'restriction', | ||
'operation', | ||
], | ||
}, | ||
"type":"object", | ||
"properties": { | ||
"dimensions": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/target_value" | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
}, | ||
type: 'object', | ||
properties: { | ||
dimensions: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/definitions/target_value', | ||
}, | ||
minItems: 1, | ||
uniqueItems: true, | ||
}, | ||
"required": [ | ||
"dimensions" | ||
] | ||
}, | ||
required: [ | ||
'dimensions', | ||
], | ||
}; |
module.exports = { | ||
"definitions": { | ||
"segment_tuple": { | ||
"type": "array", | ||
"items": [ | ||
definitions: { | ||
segment_tuple: { | ||
type: 'array', | ||
items: [ | ||
{ | ||
"type": "integer" | ||
type: 'integer', | ||
}, | ||
{ | ||
"enum": [ | ||
"OR", | ||
"AND" | ||
] | ||
} | ||
enum: [ | ||
'OR', | ||
'AND', | ||
], | ||
}, | ||
], | ||
"additionalItems": false | ||
additionalItems: false, | ||
}, | ||
"segment_array": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/segment_tuple" | ||
segment_array: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/definitions/segment_tuple', | ||
}, | ||
"minItems": 0, | ||
"uniqueItems": true | ||
} | ||
minItems: 0, | ||
uniqueItems: true, | ||
}, | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"include": { | ||
"$ref": "#/definitions/segment_array" | ||
type: 'object', | ||
properties: { | ||
include: { | ||
$ref: '#/definitions/segment_array', | ||
}, | ||
"include_op": { | ||
"enum": [ | ||
"OR", | ||
"AND" | ||
] | ||
include_op: { | ||
enum: [ | ||
'OR', | ||
'AND', | ||
], | ||
}, | ||
"exclude_op": { | ||
"enum": [ | ||
"OR", | ||
"AND" | ||
] | ||
} | ||
exclude_op: { | ||
enum: [ | ||
'OR', | ||
'AND', | ||
], | ||
}, | ||
}, | ||
"required": [ | ||
"include_op", | ||
"exclude_op" | ||
] | ||
required: [ | ||
'include_op', | ||
'exclude_op', | ||
], | ||
}; |
@@ -1,62 +0,62 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"strategy_targeting_segment": { | ||
"id": "/strategy_targeting_segment", | ||
"type": "object", | ||
"properties": { | ||
"strategy_id": { | ||
"id": "/strategy_targeting_segment/strategy_id", | ||
"type": "integer" | ||
}, | ||
"user_cpm": { | ||
"id": "/strategy_targeting_segment/user_cpm", | ||
"type": "number" | ||
}, | ||
"targeting_segment_id": { | ||
"id": "/strategy_targeting_segment/targeting_segment_id", | ||
"type": "integer" | ||
}, | ||
"operator": { | ||
"id": "/strategy_targeting_segment/operator", | ||
"enum": [ | ||
"AND", | ||
"OR" | ||
] | ||
}, | ||
"group_identifier": { | ||
"id": "/strategy_targeting_segment/group_identifier", | ||
"type": "string" | ||
}, | ||
"restriction": { | ||
"id": "/strategy_targeting_segment/restriction", | ||
"enum": [ | ||
"INCLUDE", | ||
"EXCLUDE" | ||
] | ||
}, | ||
"created_on": { | ||
"id": "/strategy_targeting_segment/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/strategy_targeting_segment/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"organization_id" | ||
] | ||
strategy_targeting_segment: { | ||
id: '/strategy_targeting_segment', | ||
type: 'object', | ||
properties: { | ||
strategy_id: { | ||
id: '/strategy_targeting_segment/strategy_id', | ||
type: 'integer', | ||
}, | ||
user_cpm: { | ||
id: '/strategy_targeting_segment/user_cpm', | ||
type: 'number', | ||
}, | ||
targeting_segment_id: { | ||
id: '/strategy_targeting_segment/targeting_segment_id', | ||
type: 'integer', | ||
}, | ||
operator: { | ||
id: '/strategy_targeting_segment/operator', | ||
enum: [ | ||
'AND', | ||
'OR', | ||
], | ||
}, | ||
group_identifier: { | ||
id: '/strategy_targeting_segment/group_identifier', | ||
type: 'string', | ||
}, | ||
restriction: { | ||
id: '/strategy_targeting_segment/restriction', | ||
enum: [ | ||
'INCLUDE', | ||
'EXCLUDE', | ||
], | ||
}, | ||
created_on: { | ||
id: '/strategy_targeting_segment/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/strategy_targeting_segment/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/strategy_targeting_segment" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
'organization_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/strategy_targeting_segment', | ||
}, | ||
], | ||
}; |
@@ -1,223 +0,223 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"strategy": { | ||
"id": "/strategy", | ||
"type": "object", | ||
"properties": { | ||
"audience_segment_exclude_op": common.logical_and_or, | ||
"audience_segment_include_op": common.logical_and_or, | ||
"bid_aggressiveness": { | ||
"id": "/strategy/bid_aggressiveness", | ||
"type": "number" | ||
}, | ||
"bid_price_is_media_only": { | ||
"id": "/strategy/bid_price_is_media_only", | ||
"type": "boolean" | ||
}, | ||
"budget": { | ||
"id": "/strategy/budget", | ||
"type": "number" | ||
}, | ||
"campaign_id": { | ||
"id": "/strategy/campaign_id", | ||
"type": "integer" | ||
}, | ||
"currency_code": { | ||
"id": "/strategy/currency_code", | ||
"type": "string" | ||
}, | ||
"description": { | ||
"id": "/strategy/description", | ||
"type": "string" | ||
}, | ||
"effective_goal_value": common.currency_array, | ||
"end_date": { | ||
"id": "/strategy/end_date", | ||
"type": "string", | ||
"format": "datetimezone" | ||
}, | ||
"feature_compatibility": { | ||
"id": "/strategy/feature_compatibility", | ||
"type": "string" | ||
}, | ||
"frequency_amount": { | ||
"id": "/strategy/frequency_amount", | ||
"type": "integer" | ||
}, | ||
"frequency_interval": { | ||
"id": "/strategy/frequency_interval", | ||
"enum": [ | ||
"hour", | ||
"day", | ||
"week", | ||
"month", | ||
"not-applicable" | ||
], | ||
"default": "not-applicable" | ||
}, | ||
"frequency_type": { | ||
"id": "/strategy/frequency_type", | ||
"enum": [ | ||
"even", | ||
"asap", | ||
"no-limit" | ||
], | ||
"default": "no-limit" | ||
}, | ||
"goal_type": { | ||
"id": "/strategy/goal_type", | ||
"enum": [ | ||
"spend", | ||
"reach", | ||
"cpc", | ||
"cpe", | ||
"cpa", | ||
"roi" | ||
], | ||
"default": "cpc" | ||
}, | ||
"goal_value": common.currency_array, | ||
"impression_cap": { | ||
"id": "/strategy/impression_cap", | ||
"type": "integer" | ||
}, | ||
"max_bid": common.currency_array, | ||
"media_type": { | ||
"id": "/strategy/media_type", | ||
"enum": [ | ||
"DISPLAY", | ||
"VIDEO" | ||
], | ||
"default": "DISPLAY" | ||
}, | ||
"pacing_amount": common.currency_array, | ||
"pacing_interval": { | ||
"id": "/strategy/pacing_interval", | ||
"enum": [ | ||
"hour", | ||
"day" | ||
], | ||
"default": "day" | ||
}, | ||
"pacing_type": { | ||
"id": "/strategy/pacing_type", | ||
"enum": [ | ||
"even", | ||
"asap" | ||
], | ||
"default": "even" | ||
}, | ||
"pixel_target_expr": { | ||
"id": "/strategy/pixel_target_expr", | ||
"type": "string" | ||
}, | ||
"run_on_all_exchanges": { | ||
"id": "/strategy/run_on_all_exchanges", | ||
"type": "boolean" | ||
}, | ||
"run_on_all_pmp": { | ||
"id": "/strategy/run_on_all_pmp", | ||
"type": "boolean" | ||
}, | ||
"run_on_display": { | ||
"id": "/strategy/run_on_display", | ||
"type": "boolean" | ||
}, | ||
"run_on_mobile": { | ||
"id": "/strategy/run_on_mobile", | ||
"type": "boolean" | ||
}, | ||
"run_on_streaming": { | ||
"id": "/strategy/run_on_streaming", | ||
"type": "boolean" | ||
}, | ||
"site_restriction_transparent_urls": { | ||
"id": "/strategy/site_restriction_transparent_urls", | ||
"type": "boolean" | ||
}, | ||
"site_selectiveness": { | ||
"id": "/strategy/site_selectiveness", | ||
"enum": [ | ||
"MATHSELECT_250", | ||
"EXCLUDE_UGC", | ||
"ALL", | ||
"REDUCED" | ||
], | ||
"default": "REDUCED" | ||
}, | ||
"start_date": { | ||
"id": "/strategy/start_date", | ||
"type": "string", | ||
"format": "datetimezone" | ||
}, | ||
"status": { | ||
"id": "/strategy/status", | ||
"type": "boolean" | ||
}, | ||
"supply_type": { | ||
"id": "/strategy/supply_type", | ||
"enum": [ | ||
"RTB", | ||
"RMX_API", | ||
"T1_RMX" | ||
], | ||
"default": "RTB" | ||
}, | ||
"type": { | ||
"id": "/strategy/type", | ||
"enum": [ | ||
"REM", | ||
"GBO", | ||
"AUD" | ||
], | ||
"default": "GBO" | ||
}, | ||
"total_budget": common.currency_array, | ||
"use_campaign_end": { | ||
"id": "/strategy/use_campaign_end", | ||
"type": "boolean" | ||
}, | ||
"use_campaign_start": { | ||
"id": "/strategy/use_campaign_start", | ||
"type": "boolean" | ||
}, | ||
"use_mm_freq": { | ||
"id": "/strategy/use_mm_freq", | ||
"type": "boolean" | ||
}, | ||
"use_optimization": { | ||
"id": "/strategy/use_optimization", | ||
"type": "boolean" | ||
}, | ||
"created_on": { | ||
"id": "/strategy/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/strategy/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"budget", | ||
"campaign_id", | ||
"goal_type", | ||
"goal_value", | ||
"max_bid", | ||
"name", | ||
"pacing_amount", | ||
"type" | ||
] | ||
strategy: { | ||
id: '/strategy', | ||
type: 'object', | ||
properties: { | ||
audience_segment_exclude_op: common.logical_and_or, | ||
audience_segment_include_op: common.logical_and_or, | ||
bid_aggressiveness: { | ||
id: '/strategy/bid_aggressiveness', | ||
type: 'number', | ||
}, | ||
bid_price_is_media_only: { | ||
id: '/strategy/bid_price_is_media_only', | ||
type: 'boolean', | ||
}, | ||
budget: { | ||
id: '/strategy/budget', | ||
type: 'number', | ||
}, | ||
campaign_id: { | ||
id: '/strategy/campaign_id', | ||
type: 'integer', | ||
}, | ||
currency_code: { | ||
id: '/strategy/currency_code', | ||
type: 'string', | ||
}, | ||
description: { | ||
id: '/strategy/description', | ||
type: 'string', | ||
}, | ||
effective_goal_value: common.currency_array, | ||
end_date: { | ||
id: '/strategy/end_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
feature_compatibility: { | ||
id: '/strategy/feature_compatibility', | ||
type: 'string', | ||
}, | ||
frequency_amount: { | ||
id: '/strategy/frequency_amount', | ||
type: 'integer', | ||
}, | ||
frequency_interval: { | ||
id: '/strategy/frequency_interval', | ||
enum: [ | ||
'hour', | ||
'day', | ||
'week', | ||
'month', | ||
'not-applicable', | ||
], | ||
default: 'not-applicable', | ||
}, | ||
frequency_type: { | ||
id: '/strategy/frequency_type', | ||
enum: [ | ||
'even', | ||
'asap', | ||
'no-limit', | ||
], | ||
default: 'no-limit', | ||
}, | ||
goal_type: { | ||
id: '/strategy/goal_type', | ||
enum: [ | ||
'spend', | ||
'reach', | ||
'cpc', | ||
'cpe', | ||
'cpa', | ||
'roi', | ||
], | ||
default: 'cpc', | ||
}, | ||
goal_value: common.currency_array, | ||
impression_cap: { | ||
id: '/strategy/impression_cap', | ||
type: 'integer', | ||
}, | ||
max_bid: common.currency_array, | ||
media_type: { | ||
id: '/strategy/media_type', | ||
enum: [ | ||
'DISPLAY', | ||
'VIDEO', | ||
], | ||
default: 'DISPLAY', | ||
}, | ||
pacing_amount: common.currency_array, | ||
pacing_interval: { | ||
id: '/strategy/pacing_interval', | ||
enum: [ | ||
'hour', | ||
'day', | ||
], | ||
default: 'day', | ||
}, | ||
pacing_type: { | ||
id: '/strategy/pacing_type', | ||
enum: [ | ||
'even', | ||
'asap', | ||
], | ||
default: 'even', | ||
}, | ||
pixel_target_expr: { | ||
id: '/strategy/pixel_target_expr', | ||
type: 'string', | ||
}, | ||
run_on_all_exchanges: { | ||
id: '/strategy/run_on_all_exchanges', | ||
type: 'boolean', | ||
}, | ||
run_on_all_pmp: { | ||
id: '/strategy/run_on_all_pmp', | ||
type: 'boolean', | ||
}, | ||
run_on_display: { | ||
id: '/strategy/run_on_display', | ||
type: 'boolean', | ||
}, | ||
run_on_mobile: { | ||
id: '/strategy/run_on_mobile', | ||
type: 'boolean', | ||
}, | ||
run_on_streaming: { | ||
id: '/strategy/run_on_streaming', | ||
type: 'boolean', | ||
}, | ||
site_restriction_transparent_urls: { | ||
id: '/strategy/site_restriction_transparent_urls', | ||
type: 'boolean', | ||
}, | ||
site_selectiveness: { | ||
id: '/strategy/site_selectiveness', | ||
enum: [ | ||
'MATHSELECT_250', | ||
'EXCLUDE_UGC', | ||
'ALL', | ||
'REDUCED', | ||
], | ||
default: 'REDUCED', | ||
}, | ||
start_date: { | ||
id: '/strategy/start_date', | ||
type: 'string', | ||
format: 'datetimezone', | ||
}, | ||
status: { | ||
id: '/strategy/status', | ||
type: 'boolean', | ||
}, | ||
supply_type: { | ||
id: '/strategy/supply_type', | ||
enum: [ | ||
'RTB', | ||
'RMX_API', | ||
'T1_RMX', | ||
], | ||
default: 'RTB', | ||
}, | ||
type: { | ||
id: '/strategy/type', | ||
enum: [ | ||
'REM', | ||
'GBO', | ||
'AUD', | ||
], | ||
default: 'GBO', | ||
}, | ||
total_budget: common.currency_array, | ||
use_campaign_end: { | ||
id: '/strategy/use_campaign_end', | ||
type: 'boolean', | ||
}, | ||
use_campaign_start: { | ||
id: '/strategy/use_campaign_start', | ||
type: 'boolean', | ||
}, | ||
use_mm_freq: { | ||
id: '/strategy/use_mm_freq', | ||
type: 'boolean', | ||
}, | ||
use_optimization: { | ||
id: '/strategy/use_optimization', | ||
type: 'boolean', | ||
}, | ||
created_on: { | ||
id: '/strategy/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/strategy/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/strategy" | ||
} | ||
] | ||
required: [ | ||
'budget', | ||
'campaign_id', | ||
'goal_type', | ||
'goal_value', | ||
'max_bid', | ||
'name', | ||
'pacing_amount', | ||
'type', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/strategy', | ||
}, | ||
], | ||
}; |
@@ -1,114 +0,114 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"supply_source": { | ||
"id": "/supply_source", | ||
"type": "object", | ||
"properties": { | ||
"bidder_exchange_identifier": { | ||
"id": "/supply_source/bidder_exchange_identifier", | ||
"type": "integer" | ||
}, | ||
"code": { | ||
"id": "/supply_source/code", | ||
"type": "string" | ||
}, | ||
"default_seat_identifier": { | ||
"id": "/supply_source/default_seat_identifier", | ||
"type": "string" | ||
}, | ||
"distribute": { | ||
"id": "/supply_source/distribute", | ||
"type": "boolean" | ||
}, | ||
"has_display": { | ||
"id": "/supply_source/has_display", | ||
"type": "boolean" | ||
}, | ||
"has_mobile_display": { | ||
"id": "/supply_source/has_mobile_display", | ||
"type": "boolean" | ||
}, | ||
"has_mobile_video": { | ||
"id": "/supply_source/has_mobile_video", | ||
"type": "boolean" | ||
}, | ||
"has_video": { | ||
"id": "/supply_source/has_video", | ||
"type": "boolean" | ||
}, | ||
"is_proservice": { | ||
"id": "/supply_source/is_proservice", | ||
"type": "boolean" | ||
}, | ||
"mm_safe": { | ||
"id": "/supply_source/mm_safe", | ||
"type": "boolean" | ||
}, | ||
"parent_supply_id": { | ||
"id": "/supply_source/parent_supply_id", | ||
"type": "integer" | ||
}, | ||
"pixel_tag": { | ||
"id": "/supply_source/pixel_tag", | ||
"type": "string" | ||
}, | ||
"pmp_enabled": { | ||
"id": "/supply_source/pmp_enabled", | ||
"type": "boolean" | ||
}, | ||
"rtb_enabled": { | ||
"id": "/supply_source/rtb_enabled", | ||
"type": "boolean" | ||
}, | ||
"rtb_type": { | ||
"id": "/supply_source/rtb_type", | ||
"enum": [ | ||
"STANDARD", | ||
"MARKETPLACE" | ||
] | ||
}, | ||
"seat_enabled": { | ||
"id": "/supply_source/seat_enabled", | ||
"type": "boolean" | ||
}, | ||
"status": { | ||
"id": "/supply_source/status", | ||
"type": "boolean" | ||
}, | ||
"supply_type": { | ||
"id": "/supply_source/supply_type", | ||
"enum": [ | ||
"exchange", | ||
"data" | ||
] | ||
}, | ||
"use_pool": { | ||
"id": "/supply_source/use_pool", | ||
"type": "boolean" | ||
}, | ||
"created_on": { | ||
"id": "/supply_source/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/supply_source/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"code", | ||
"name" | ||
] | ||
supply_source: { | ||
id: '/supply_source', | ||
type: 'object', | ||
properties: { | ||
bidder_exchange_identifier: { | ||
id: '/supply_source/bidder_exchange_identifier', | ||
type: 'integer', | ||
}, | ||
code: { | ||
id: '/supply_source/code', | ||
type: 'string', | ||
}, | ||
default_seat_identifier: { | ||
id: '/supply_source/default_seat_identifier', | ||
type: 'string', | ||
}, | ||
distribute: { | ||
id: '/supply_source/distribute', | ||
type: 'boolean', | ||
}, | ||
has_display: { | ||
id: '/supply_source/has_display', | ||
type: 'boolean', | ||
}, | ||
has_mobile_display: { | ||
id: '/supply_source/has_mobile_display', | ||
type: 'boolean', | ||
}, | ||
has_mobile_video: { | ||
id: '/supply_source/has_mobile_video', | ||
type: 'boolean', | ||
}, | ||
has_video: { | ||
id: '/supply_source/has_video', | ||
type: 'boolean', | ||
}, | ||
is_proservice: { | ||
id: '/supply_source/is_proservice', | ||
type: 'boolean', | ||
}, | ||
mm_safe: { | ||
id: '/supply_source/mm_safe', | ||
type: 'boolean', | ||
}, | ||
parent_supply_id: { | ||
id: '/supply_source/parent_supply_id', | ||
type: 'integer', | ||
}, | ||
pixel_tag: { | ||
id: '/supply_source/pixel_tag', | ||
type: 'string', | ||
}, | ||
pmp_enabled: { | ||
id: '/supply_source/pmp_enabled', | ||
type: 'boolean', | ||
}, | ||
rtb_enabled: { | ||
id: '/supply_source/rtb_enabled', | ||
type: 'boolean', | ||
}, | ||
rtb_type: { | ||
id: '/supply_source/rtb_type', | ||
enum: [ | ||
'STANDARD', | ||
'MARKETPLACE', | ||
], | ||
}, | ||
seat_enabled: { | ||
id: '/supply_source/seat_enabled', | ||
type: 'boolean', | ||
}, | ||
status: { | ||
id: '/supply_source/status', | ||
type: 'boolean', | ||
}, | ||
supply_type: { | ||
id: '/supply_source/supply_type', | ||
enum: [ | ||
'exchange', | ||
'data', | ||
], | ||
}, | ||
use_pool: { | ||
id: '/supply_source/use_pool', | ||
type: 'boolean', | ||
}, | ||
created_on: { | ||
id: '/supply_source/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/supply_source/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/supply_source" | ||
} | ||
] | ||
required: [ | ||
'code', | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/supply_source', | ||
}, | ||
], | ||
}; |
@@ -1,21 +0,21 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"target_dimension": { | ||
"id": "/target_dimension", | ||
"type": "object", | ||
"properties": { | ||
"code": { | ||
"id": "/target_dimension/code", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [] | ||
target_dimension: { | ||
id: '/target_dimension', | ||
type: 'object', | ||
properties: { | ||
code: { | ||
id: '/target_dimension/code', | ||
type: 'string', | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/target_dimension" | ||
} | ||
] | ||
required: [], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/target_dimension', | ||
}, | ||
], | ||
}; |
@@ -1,41 +0,41 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"target_value": { | ||
"id": "/target_value", | ||
"type": "object", | ||
"properties": { | ||
"dimension_code": { | ||
"id": "/target_value/dimension_code", | ||
"type": "string" | ||
}, | ||
"child_count": { | ||
"id": "/target_value/child_count", | ||
"type": "integer" | ||
}, | ||
"is_targetable": { | ||
"id": "/target_value/is_targetable", | ||
"type": "boolean" | ||
}, | ||
"target_dimension_id": { | ||
"id": "/target_value/target_dimension_id", | ||
"type": "integer" | ||
}, | ||
"value": { | ||
"id": "/target_value/value", | ||
"type": "integer" | ||
}, | ||
"type": { | ||
"id": "/target_value/type", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [] | ||
target_value: { | ||
id: '/target_value', | ||
type: 'object', | ||
properties: { | ||
dimension_code: { | ||
id: '/target_value/dimension_code', | ||
type: 'string', | ||
}, | ||
child_count: { | ||
id: '/target_value/child_count', | ||
type: 'integer', | ||
}, | ||
is_targetable: { | ||
id: '/target_value/is_targetable', | ||
type: 'boolean', | ||
}, | ||
target_dimension_id: { | ||
id: '/target_value/target_dimension_id', | ||
type: 'integer', | ||
}, | ||
value: { | ||
id: '/target_value/value', | ||
type: 'integer', | ||
}, | ||
type: { | ||
id: '/target_value/type', | ||
type: 'string', | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/target_value" | ||
} | ||
] | ||
required: [], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/target_value', | ||
}, | ||
], | ||
}; |
@@ -1,48 +0,48 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"targeting_vendor": { | ||
"id": "/targeting_vendor", | ||
"type": "object", | ||
"properties": { | ||
"organization_id": { | ||
"id": "/targeting_vendor/organization_id", | ||
"type": "integer" | ||
}, | ||
"targeting_vendor_type_id": { | ||
"id": "/targeting_vendor/targeting_vendor_type_id", | ||
"type": "integer" | ||
}, | ||
"sites_count_domain": { | ||
"id": "/targeting_vendor/sites_count_domain", | ||
"type": "integer" | ||
}, | ||
"namespace_code": { | ||
"id": "/targeting_vendor/namespace_code", | ||
"type": "string" | ||
}, | ||
"created_on": { | ||
"id": "/targeting_vendor/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/targeting_vendor/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"organization_id" | ||
] | ||
targeting_vendor: { | ||
id: '/targeting_vendor', | ||
type: 'object', | ||
properties: { | ||
organization_id: { | ||
id: '/targeting_vendor/organization_id', | ||
type: 'integer', | ||
}, | ||
targeting_vendor_type_id: { | ||
id: '/targeting_vendor/targeting_vendor_type_id', | ||
type: 'integer', | ||
}, | ||
sites_count_domain: { | ||
id: '/targeting_vendor/sites_count_domain', | ||
type: 'integer', | ||
}, | ||
namespace_code: { | ||
id: '/targeting_vendor/namespace_code', | ||
type: 'string', | ||
}, | ||
created_on: { | ||
id: '/targeting_vendor/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/targeting_vendor/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/targeting_vendor" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
'organization_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/targeting_vendor', | ||
}, | ||
], | ||
}; |
@@ -1,173 +0,173 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"user": { | ||
"id": "/user", | ||
"type": "object", | ||
"properties": { | ||
"access_internal_fees": { | ||
"id": "/user/access_internal_fees", | ||
"type": "boolean" | ||
}, | ||
"active": { | ||
"id": "/user/active", | ||
"type": "boolean" | ||
}, | ||
"creator_id": { | ||
"id": "/user/creator_id", | ||
"type": "integer", | ||
"readonly": true | ||
}, | ||
"edit_campaigns": { | ||
"id": "/user/edit_campaigns", | ||
"type": "boolean" | ||
}, | ||
"edit_data_definition": { | ||
"id": "/user/edit_data_definition", | ||
"type": "boolean" | ||
}, | ||
"edit_margins_and_performance": { | ||
"id": "/user/edit_margins_and_performance", | ||
"type": "boolean" | ||
}, | ||
"fax": { | ||
"id": "/user/fax", | ||
"type": "string" | ||
}, | ||
"first_name": { | ||
"id": "/user/first_name", | ||
"type": "string" | ||
}, | ||
"labs_enable_rmx": { | ||
"id": "/user/labs_enable_rmx", | ||
"type": "boolean" | ||
}, | ||
"last_login_on": { | ||
"id": "/user/last_login_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"last_name": { | ||
"id": "/user/last_name", | ||
"type": "string" | ||
}, | ||
"link_ldap": { | ||
"id": "/user/link_ldap", | ||
"type": "boolean" | ||
}, | ||
"mobile": { | ||
"id": "/user/mobile", | ||
"type": "string" | ||
}, | ||
"password": { | ||
"id": "/user/password", | ||
"type": "string" | ||
}, | ||
"password_reset_sent": { | ||
"id": "/user/password_reset_sent", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"password_reset_token": { | ||
"id": "/user/password_reset_token", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"phone": { | ||
"id": "/user/phone", | ||
"type": "string" | ||
}, | ||
"role": { | ||
"id": "/user/role", | ||
"enum": [ | ||
"ADMIN", | ||
"MANAGER", | ||
"REPORTER" | ||
], | ||
"default": "REPORTER" | ||
}, | ||
"scope": { | ||
"id": "/user/role", | ||
"enum": [ | ||
"GLOBAL", | ||
"SELECT" | ||
], | ||
"default": "SELECT" | ||
}, | ||
"sso_auth_sent": { | ||
"id": "/user/sso_auth_sent", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"sso_auth_token": { | ||
"id": "/user/sso_auth_token", | ||
"type": "string", | ||
"readonly": true | ||
}, | ||
"title": { | ||
"id": "/user/title", | ||
"type": "string" | ||
}, | ||
"type": { | ||
"id": "/user/type", | ||
"enum": [ | ||
"INTERNAL", | ||
"AGENCY", | ||
"VPAN", | ||
"ADVERTISER" | ||
], | ||
"default": "ADVERTISER" | ||
}, | ||
"username": { | ||
"id": "/user/username", | ||
"type": "string" | ||
}, | ||
"view_data_definition": { | ||
"id": "/user/view_data_definition", | ||
"type": "boolean" | ||
}, | ||
"view_dmp_reports": { | ||
"id": "/user/view_dmp_reports", | ||
"type": "boolean" | ||
}, | ||
"view_segments": { | ||
"id": "/user/view_segments", | ||
"type": "boolean" | ||
}, | ||
"view_organizations": { | ||
"id": "/user/view_organizations", | ||
"type": "boolean" | ||
}, | ||
"created_on": { | ||
"id": "/user/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/user/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"first_name", | ||
"last_name", | ||
"role", | ||
"scope", | ||
"title", | ||
"type", | ||
"username" | ||
] | ||
user: { | ||
id: '/user', | ||
type: 'object', | ||
properties: { | ||
access_internal_fees: { | ||
id: '/user/access_internal_fees', | ||
type: 'boolean', | ||
}, | ||
active: { | ||
id: '/user/active', | ||
type: 'boolean', | ||
}, | ||
creator_id: { | ||
id: '/user/creator_id', | ||
type: 'integer', | ||
readonly: true, | ||
}, | ||
edit_campaigns: { | ||
id: '/user/edit_campaigns', | ||
type: 'boolean', | ||
}, | ||
edit_data_definition: { | ||
id: '/user/edit_data_definition', | ||
type: 'boolean', | ||
}, | ||
edit_margins_and_performance: { | ||
id: '/user/edit_margins_and_performance', | ||
type: 'boolean', | ||
}, | ||
fax: { | ||
id: '/user/fax', | ||
type: 'string', | ||
}, | ||
first_name: { | ||
id: '/user/first_name', | ||
type: 'string', | ||
}, | ||
labs_enable_rmx: { | ||
id: '/user/labs_enable_rmx', | ||
type: 'boolean', | ||
}, | ||
last_login_on: { | ||
id: '/user/last_login_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
last_name: { | ||
id: '/user/last_name', | ||
type: 'string', | ||
}, | ||
link_ldap: { | ||
id: '/user/link_ldap', | ||
type: 'boolean', | ||
}, | ||
mobile: { | ||
id: '/user/mobile', | ||
type: 'string', | ||
}, | ||
password: { | ||
id: '/user/password', | ||
type: 'string', | ||
}, | ||
password_reset_sent: { | ||
id: '/user/password_reset_sent', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
password_reset_token: { | ||
id: '/user/password_reset_token', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
phone: { | ||
id: '/user/phone', | ||
type: 'string', | ||
}, | ||
role: { | ||
id: '/user/role', | ||
enum: [ | ||
'ADMIN', | ||
'MANAGER', | ||
'REPORTER', | ||
], | ||
default: 'REPORTER', | ||
}, | ||
scope: { | ||
id: '/user/role', | ||
enum: [ | ||
'GLOBAL', | ||
'SELECT', | ||
], | ||
default: 'SELECT', | ||
}, | ||
sso_auth_sent: { | ||
id: '/user/sso_auth_sent', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
sso_auth_token: { | ||
id: '/user/sso_auth_token', | ||
type: 'string', | ||
readonly: true, | ||
}, | ||
title: { | ||
id: '/user/title', | ||
type: 'string', | ||
}, | ||
type: { | ||
id: '/user/type', | ||
enum: [ | ||
'INTERNAL', | ||
'AGENCY', | ||
'VPAN', | ||
'ADVERTISER', | ||
], | ||
default: 'ADVERTISER', | ||
}, | ||
username: { | ||
id: '/user/username', | ||
type: 'string', | ||
}, | ||
view_data_definition: { | ||
id: '/user/view_data_definition', | ||
type: 'boolean', | ||
}, | ||
view_dmp_reports: { | ||
id: '/user/view_dmp_reports', | ||
type: 'boolean', | ||
}, | ||
view_segments: { | ||
id: '/user/view_segments', | ||
type: 'boolean', | ||
}, | ||
view_organizations: { | ||
id: '/user/view_organizations', | ||
type: 'boolean', | ||
}, | ||
created_on: { | ||
id: '/user/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/user/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/user" | ||
} | ||
] | ||
required: [ | ||
'first_name', | ||
'last_name', | ||
'role', | ||
'scope', | ||
'title', | ||
'type', | ||
'username', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/user', | ||
}, | ||
], | ||
}; |
@@ -1,69 +0,67 @@ | ||
var common = require('./common'); | ||
module.exports = { | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"allEndpoints": { | ||
"id": "/allEndpoints", | ||
"type": "object", | ||
"properties": { | ||
"full": { | ||
"id": "/allEndpoints/full", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
$schema: 'http://json-schema.org/draft-04/schema#', | ||
allEndpoints: { | ||
id: '/allEndpoints', | ||
type: 'object', | ||
properties: { | ||
full: { | ||
id: '/allEndpoints/full', | ||
type: 'array', | ||
items: { | ||
type: 'string', | ||
}, | ||
minItems: 1, | ||
uniqueItems: true, | ||
}, | ||
limit: { | ||
id: '/allEndpoints/limit', | ||
type: 'object', | ||
patternProperties: { | ||
'^[a-zA-Z\\.]+$': { type: 'integer' }, | ||
}, | ||
additionalProperties: false, | ||
maxProperties: 1, | ||
}, | ||
page_limit: { | ||
id: '/allEndpoints/page_limit', | ||
type: 'integer', | ||
}, | ||
page_offset: { | ||
id: '/allEndpoints/page_offset', | ||
type: 'integer', | ||
}, | ||
q: { | ||
id: '/allEndpoints/q', | ||
type: 'string', | ||
}, | ||
sort_by: { | ||
id: '/allEndpoints/sort_by', | ||
type: 'string', | ||
}, | ||
with: { | ||
id: '/allEndpoints/with', | ||
type: 'array', | ||
items: { | ||
anyOf: [ | ||
{ | ||
type: 'array', | ||
items: { | ||
type: 'string', | ||
}, | ||
}, | ||
"limit": { | ||
"id": "/allEndpoints/limit", | ||
"type": "object", | ||
"patternProperties": { | ||
"^[a-zA-Z\.]+$": {"type": "integer"} | ||
}, | ||
"additionalProperties": false, | ||
"maxProperties": 1 | ||
{ | ||
type: 'string', | ||
}, | ||
"page_limit": { | ||
"id": "/allEndpoints/page_limit", | ||
"type": "integer" | ||
}, | ||
"page_offset": { | ||
"id": "/allEndpoints/page_offset", | ||
"type": "integer" | ||
}, | ||
"q": { | ||
"id": "/allEndpoints/q", | ||
"type": "string" | ||
}, | ||
"sort_by": { | ||
"id": "/allEndpoints/sort_by", | ||
"type": "string" | ||
}, | ||
"with": { | ||
"id": "/allEndpoints/with", | ||
"type": "array", | ||
"items": { | ||
"anyOf": [ | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
{ | ||
"type": "string" | ||
} | ||
] | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
} | ||
], | ||
}, | ||
minItems: 1, | ||
uniqueItems: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
{ | ||
"$ref": "#/allEndpoints" | ||
} | ||
] | ||
}, | ||
allOf: [ | ||
{ | ||
$ref: '#/allEndpoints', | ||
}, | ||
], | ||
}; |
@@ -1,51 +0,51 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"vendor_contract": { | ||
"id": "/vendor_contract", | ||
"type": "object", | ||
"properties": { | ||
"campaign_id": { | ||
"id": "/vendor_contract/campaign_id", | ||
"type": "integer" | ||
vendor_contract: { | ||
id: '/vendor_contract', | ||
type: 'object', | ||
properties: { | ||
campaign_id: { | ||
id: '/vendor_contract/campaign_id', | ||
type: 'integer', | ||
}, | ||
"price": { | ||
"id": "/vendor_contract/price", | ||
"type": "number" | ||
price: { | ||
id: '/vendor_contract/price', | ||
type: 'number', | ||
}, | ||
"rate_card_type": { | ||
"id": "/vendor_contract/rate_card_type", | ||
"type": "string" | ||
rate_card_type: { | ||
id: '/vendor_contract/rate_card_type', | ||
type: 'string', | ||
}, | ||
"use_mm_contract": { | ||
"id": "/vendor_contract/use_mm_contract", | ||
"type": "boolean" | ||
use_mm_contract: { | ||
id: '/vendor_contract/use_mm_contract', | ||
type: 'boolean', | ||
}, | ||
"vendor_id": { | ||
"id": "/vendor_contract/vendor_id", | ||
"type": "integer" | ||
vendor_id: { | ||
id: '/vendor_contract/vendor_id', | ||
type: 'integer', | ||
}, | ||
"created_on": { | ||
"id": "/vendor_contract/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
created_on: { | ||
id: '/vendor_contract/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
"updated_on": { | ||
"id": "/vendor_contract/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
updated_on: { | ||
id: '/vendor_contract/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
required: [ | ||
'name', | ||
], | ||
}, | ||
"allOf": [ | ||
allOf: [ | ||
common.entity, | ||
{ | ||
"$ref": "#/vendor_contract" | ||
} | ||
] | ||
$ref: '#/vendor_contract', | ||
}, | ||
], | ||
}; |
@@ -1,44 +0,44 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"vendor_domain": { | ||
"id": "/vendor_domain", | ||
"type": "object", | ||
"properties": { | ||
"allow_subdomain_match": { | ||
"id": "/vendor_domain/allow_subdomain_match", | ||
"type": "boolean" | ||
}, | ||
"domain": { | ||
"id": "/vendor_domain/domain", | ||
"type": "string" | ||
}, | ||
"vendor_id": { | ||
"id": "/vendor_domain/vendor_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/vendor_domain/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/vendor_domain/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"domain", | ||
"vendor_id" | ||
] | ||
vendor_domain: { | ||
id: '/vendor_domain', | ||
type: 'object', | ||
properties: { | ||
allow_subdomain_match: { | ||
id: '/vendor_domain/allow_subdomain_match', | ||
type: 'boolean', | ||
}, | ||
domain: { | ||
id: '/vendor_domain/domain', | ||
type: 'string', | ||
}, | ||
vendor_id: { | ||
id: '/vendor_domain/vendor_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/vendor_domain/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/vendor_domain/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/vendor_domain" | ||
} | ||
] | ||
required: [ | ||
'domain', | ||
'vendor_id', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/vendor_domain', | ||
}, | ||
], | ||
}; |
@@ -1,41 +0,41 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"vendor_pixel_domain": { | ||
"id": "/vendor_pixel_domain", | ||
"type": "object", | ||
"properties": { | ||
"domain": { | ||
"id": "/vendor_pixel_domain/domain", | ||
"type": "string" | ||
}, | ||
"vendor_domain_id": { | ||
"id": "/vendor_pixel_domain/vendor_domain_id", | ||
"type": "integer" | ||
}, | ||
"vendor_pixel_id": { | ||
"id": "/vendor_pixel_domain/vendor_pixel_id", | ||
"type": "integer" | ||
}, | ||
"created_on": { | ||
"id": "/vendor_pixel_domain/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/vendor_pixel_domain/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [] | ||
vendor_pixel_domain: { | ||
id: '/vendor_pixel_domain', | ||
type: 'object', | ||
properties: { | ||
domain: { | ||
id: '/vendor_pixel_domain/domain', | ||
type: 'string', | ||
}, | ||
vendor_domain_id: { | ||
id: '/vendor_pixel_domain/vendor_domain_id', | ||
type: 'integer', | ||
}, | ||
vendor_pixel_id: { | ||
id: '/vendor_pixel_domain/vendor_pixel_id', | ||
type: 'integer', | ||
}, | ||
created_on: { | ||
id: '/vendor_pixel_domain/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/vendor_pixel_domain/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/vendor_pixel_domain" | ||
} | ||
] | ||
required: [], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/vendor_pixel_domain', | ||
}, | ||
], | ||
}; |
@@ -1,51 +0,51 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"vendor_pixel": { | ||
"id": "/vendor_pixel", | ||
"type": "object", | ||
"properties": { | ||
"creative_id": { | ||
"id": "/vendor_pixel/creative_id", | ||
"type": "integer" | ||
}, | ||
"set_by": { | ||
"id": "/vendor_pixel/set_by", | ||
"enum": [ | ||
"SYSTEM", | ||
"USER" | ||
], | ||
"default": "USER" | ||
}, | ||
"tag": { | ||
"id": "/vendor_pixel/tag", | ||
"type": "string" | ||
}, | ||
"tag_type": { | ||
"id": "/vendor_pixel/tag_type", | ||
"type": "string" | ||
}, | ||
"created_on": { | ||
"id": "/vendor_pixel/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/vendor_pixel/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
vendor_pixel: { | ||
id: '/vendor_pixel', | ||
type: 'object', | ||
properties: { | ||
creative_id: { | ||
id: '/vendor_pixel/creative_id', | ||
type: 'integer', | ||
}, | ||
set_by: { | ||
id: '/vendor_pixel/set_by', | ||
enum: [ | ||
'SYSTEM', | ||
'USER', | ||
], | ||
default: 'USER', | ||
}, | ||
tag: { | ||
id: '/vendor_pixel/tag', | ||
type: 'string', | ||
}, | ||
tag_type: { | ||
id: '/vendor_pixel/tag_type', | ||
type: 'string', | ||
}, | ||
created_on: { | ||
id: '/vendor_pixel/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/vendor_pixel/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/vendor_pixel" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/vendor_pixel', | ||
}, | ||
], | ||
}; |
@@ -1,99 +0,99 @@ | ||
var common = require('./common') | ||
const common = require('./common'); | ||
module.exports = { | ||
"vendor": { | ||
"id": "/vendor", | ||
"type": "object", | ||
"properties": { | ||
"adx_approved": { | ||
"id": "/vendor/adx_approved", | ||
"type": "boolean" | ||
vendor: { | ||
id: '/vendor', | ||
type: 'object', | ||
properties: { | ||
adx_approved: { | ||
id: '/vendor/adx_approved', | ||
type: 'boolean', | ||
}, | ||
"adx_declaration_required": { | ||
"id": "/vendor/adx_declaration_required", | ||
"type": "boolean" | ||
adx_declaration_required: { | ||
id: '/vendor/adx_declaration_required', | ||
type: 'boolean', | ||
}, | ||
"adx_ssl_approved": { | ||
"id": "/vendor/adx_ssl_approved", | ||
"type": "boolean" | ||
adx_ssl_approved: { | ||
id: '/vendor/adx_ssl_approved', | ||
type: 'boolean', | ||
}, | ||
"adx_vendor_identifier": { | ||
"id": "/vendor/adx_vendor_identifier", | ||
"type": "string" | ||
adx_vendor_identifier: { | ||
id: '/vendor/adx_vendor_identifier', | ||
type: 'string', | ||
}, | ||
"adx_video_approved": { | ||
"id": "/vendor/adx_video_approved", | ||
"type": "boolean" | ||
adx_video_approved: { | ||
id: '/vendor/adx_video_approved', | ||
type: 'boolean', | ||
}, | ||
"adx_video_ssl_approved": { | ||
"id": "/vendor/adx_video_ssl_approved", | ||
"type": "boolean" | ||
adx_video_ssl_approved: { | ||
id: '/vendor/adx_video_ssl_approved', | ||
type: 'boolean', | ||
}, | ||
"description": { | ||
"id": "/vendor/description", | ||
"type": "string" | ||
description: { | ||
id: '/vendor/description', | ||
type: 'string', | ||
}, | ||
"is_eligible": { | ||
"id": "/vendor/is_eligible", | ||
"type": "boolean" | ||
is_eligible: { | ||
id: '/vendor/is_eligible', | ||
type: 'boolean', | ||
}, | ||
"mm_contract_available": { | ||
"id": "/vendor/mm_contract_available", | ||
"type": "boolean" | ||
mm_contract_available: { | ||
id: '/vendor/mm_contract_available', | ||
type: 'boolean', | ||
}, | ||
"rate_card_price": { | ||
"id": "/vendor/rate_card_price", | ||
"type": "number" | ||
rate_card_price: { | ||
id: '/vendor/rate_card_price', | ||
type: 'number', | ||
}, | ||
"rate_card_type": { | ||
"id": "/vendor/rate_card_type", | ||
"type": "string" | ||
rate_card_type: { | ||
id: '/vendor/rate_card_type', | ||
type: 'string', | ||
}, | ||
"vendor_type": { | ||
"id": "/vendor/vendor_type", | ||
"type": { | ||
"enum": [ | ||
"AD_SERVER", | ||
"AD_VERIFICATION", | ||
"CONTEXTUAL", | ||
"DATA", | ||
"DSP", | ||
"DYNAMIC_CREATIVE", | ||
"NETWORK", | ||
"OBA_COMPLIANCE", | ||
"OTHER", | ||
"PIXEL_TRACKING", | ||
"RICH_MEDIA", | ||
"SURVEY" | ||
] | ||
vendor_type: { | ||
id: '/vendor/vendor_type', | ||
type: { | ||
enum: [ | ||
'AD_SERVER', | ||
'AD_VERIFICATION', | ||
'CONTEXTUAL', | ||
'DATA', | ||
'DSP', | ||
'DYNAMIC_CREATIVE', | ||
'NETWORK', | ||
'OBA_COMPLIANCE', | ||
'OTHER', | ||
'PIXEL_TRACKING', | ||
'RICH_MEDIA', | ||
'SURVEY', | ||
], | ||
}, | ||
"default": "OTHER" | ||
default: 'OTHER', | ||
}, | ||
"wholesale_price": { | ||
"id": "/vendor/wholesale_price", | ||
"type": "number" | ||
wholesale_price: { | ||
id: '/vendor/wholesale_price', | ||
type: 'number', | ||
}, | ||
"created_on": { | ||
"id": "/vendor/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
created_on: { | ||
id: '/vendor/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
"updated_on": { | ||
"id": "/vendor/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
updated_on: { | ||
id: '/vendor/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
required: [ | ||
'name', | ||
], | ||
}, | ||
"allOf": [ | ||
allOf: [ | ||
common.entity, | ||
{ | ||
"$ref": "#/vendor" | ||
} | ||
] | ||
$ref: '#/vendor', | ||
}, | ||
], | ||
}; |
@@ -1,31 +0,31 @@ | ||
var common = require('./common'); | ||
const common = require('./common'); | ||
module.exports = { | ||
"vertical": { | ||
"id": "/vertical", | ||
"type": "object", | ||
"properties": { | ||
"created_on": { | ||
"id": "/vertical/created_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
}, | ||
"updated_on": { | ||
"id": "/vertical/updated_on", | ||
"type": "string", | ||
"format": "datetimezone", | ||
"readonly": true | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
vertical: { | ||
id: '/vertical', | ||
type: 'object', | ||
properties: { | ||
created_on: { | ||
id: '/vertical/created_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
updated_on: { | ||
id: '/vertical/updated_on', | ||
type: 'string', | ||
format: 'datetimezone', | ||
readonly: true, | ||
}, | ||
}, | ||
"allOf": [ | ||
common.entity, | ||
{ | ||
"$ref": "#/vertical" | ||
} | ||
] | ||
required: [ | ||
'name', | ||
], | ||
}, | ||
allOf: [ | ||
common.entity, | ||
{ | ||
$ref: '#/vertical', | ||
}, | ||
], | ||
}; |
@@ -1,76 +0,113 @@ | ||
"use strict"; | ||
const jsonrefs = require('json-refs'); | ||
const Validator = require('jsonschema').Validator; | ||
const ad_server = require('./schema/ad_server'); | ||
const advertiser = require('./schema/advertiser'); | ||
const agency = require('./schema/agency'); | ||
const atomic_creative = require('./schema/atomic_creative'); | ||
const audience_segment = require('./schema/audience_segment'); | ||
const campaign = require('./schema/campaign'); | ||
const common = require('./schema/common'); | ||
const concept = require('./schema/concept'); | ||
const container_single = require('./schema/container_single'); | ||
const creative = require('./schema/creative'); | ||
const creative_approval = require('./schema/creative_approval'); | ||
const deal = require('./schema/deal'); | ||
const organization = require('./schema/organization'); | ||
const pixel = require('./schema/pixel'); | ||
const pixel_bundle = require('./schema/pixel_bundle'); | ||
const pixel_provider = require('./schema/pixel_provider'); | ||
const placement_slot = require('./schema/placement_slot'); | ||
const publisher = require('./schema/publisher'); | ||
const publisher_site = require('./schema/publisher_site'); | ||
const site_list = require('./schema/site_list'); | ||
const site_placement = require('./schema/site_placement'); | ||
const strategy = require('./schema/strategy'); | ||
const strategy_audience_segment = require('./schema/strategy_audience_segment'); | ||
const strategy_audience_segment_form = require('./schema/strategy_audience_segment_form'); | ||
const strategy_concept = require('./schema/strategy_concept'); | ||
const strategy_day_part = require('./schema/strategy_day_part'); | ||
const strategy_domain = require('./schema/strategy_domain'); | ||
const strategy_supply_source = require('./schema/strategy_supply_source'); | ||
const strategy_targeting_segment = require('./schema/strategy_targeting_segment'); | ||
const strategy_targeting_segment_form = require('./schema/strategy_targeting_segment_form'); | ||
const strategy_target_values_form = require('./schema/strategy_target_values_form'); | ||
const supply_source = require('./schema/supply_source'); | ||
const target_dimension = require('./schema/target_dimension'); | ||
const target_value = require('./schema/target_value'); | ||
const targeting_vendor = require('./schema/targeting_vendor'); | ||
const user = require('./schema/user'); | ||
const userparams = require('./schema/userparams'); | ||
const vendor = require('./schema/vendor'); | ||
const vendor_contract = require('./schema/vendor_contract'); | ||
const vendor_domain = require('./schema/vendor_domain'); | ||
const vendor_pixel = require('./schema/vendor_pixel'); | ||
const vendor_pixel_domain = require('./schema/vendor_pixel_domain'); | ||
const vertical = require('./schema/vertical'); | ||
var jsonrefs = require('json-refs'); | ||
var _schemas = { | ||
'ad_server': require('./schema/ad_server'), | ||
'advertiser': require('./schema/advertiser'), | ||
'agency': require('./schema/agency'), | ||
'atomic_creative': require('./schema/atomic_creative'), | ||
'audience_segment': require('./schema/audience_segment'), | ||
'campaign': require('./schema/campaign'), | ||
'common': require('./schema/common'), | ||
'concept': require('./schema/concept'), | ||
'container_single': require('./schema/container_single'), | ||
'creative': require('./schema/creative'), | ||
'creative_approval': require('./schema/creative_approval'), | ||
'deal': require('./schema/deal'), | ||
'organization': require('./schema/organization'), | ||
'pixel': require('./schema/pixel'), | ||
'pixel_bundle': require('./schema/pixel_bundle'), | ||
'pixel_provider': require('./schema/pixel_provider'), | ||
'placement_slot': require('./schema/placement_slot'), | ||
'publisher': require('./schema/publisher'), | ||
'publisher_site': require('./schema/publisher_site'), | ||
'site_list': require('./schema/site_list'), | ||
'site_placement': require('./schema/site_placement'), | ||
'strategy': require('./schema/strategy'), | ||
'strategy_audience_segment': require('./schema/strategy_audience_segment'), | ||
'strategy_audience_segment_form': require('./schema/strategy_audience_segment_form'), | ||
'strategy_concept': require('./schema/strategy_concept'), | ||
'strategy_day_part': require('./schema/strategy_day_part'), | ||
'strategy_domain': require('./schema/strategy_domain'), | ||
'strategy_supply_source': require('./schema/strategy_supply_source'), | ||
'strategy_targeting_segment': require('./schema/strategy_targeting_segment'), | ||
'strategy_targeting_segment_form': require('./schema/strategy_targeting_segment_form'), | ||
'strategy_target_values_form': require('./schema/strategy_target_values_form'), | ||
'supply_source': require('./schema/supply_source'), | ||
'target_dimension': require('./schema/target_dimension'), | ||
'target_value': require('./schema/target_value'), | ||
'targeting_vendor': require('./schema/targeting_vendor'), | ||
'user': require('./schema/user'), | ||
'userparams': require('./schema/userparams'), | ||
'vendor': require('./schema/vendor'), | ||
'vendor_contract': require('./schema/vendor_contract'), | ||
'vendor_domain': require('./schema/vendor_domain'), | ||
'vendor_pixel': require('./schema/vendor_pixel'), | ||
'vendor_pixel_domain': require('./schema/vendor_pixel_domain'), | ||
'vertical': require('./schema/vertical') | ||
const schemas = { | ||
ad_server, | ||
advertiser, | ||
agency, | ||
atomic_creative, | ||
audience_segment, | ||
campaign, | ||
common, | ||
concept, | ||
container_single, | ||
creative, | ||
creative_approval, | ||
deal, | ||
organization, | ||
pixel, | ||
pixel_bundle, | ||
pixel_provider, | ||
placement_slot, | ||
publisher, | ||
publisher_site, | ||
site_list, | ||
site_placement, | ||
strategy, | ||
strategy_audience_segment, | ||
strategy_audience_segment_form, | ||
strategy_concept, | ||
strategy_day_part, | ||
strategy_domain, | ||
strategy_supply_source, | ||
strategy_targeting_segment, | ||
strategy_targeting_segment_form, | ||
strategy_target_values_form, | ||
supply_source, | ||
target_dimension, | ||
target_value, | ||
targeting_vendor, | ||
user, | ||
userparams, | ||
vendor, | ||
vendor_contract, | ||
vendor_domain, | ||
vendor_pixel, | ||
vendor_pixel_domain, | ||
vertical, | ||
}; | ||
function getSchema(schemaName) { | ||
var jsonRefsOptions = { | ||
depth: 2 | ||
}; | ||
return jsonrefs.resolveRefs(_schemas[schemaName], jsonRefsOptions).then(function(schema){ | ||
return schema.resolved; | ||
}); | ||
const jsonRefsOptions = { | ||
depth: 2, | ||
}; | ||
return jsonrefs.resolveRefs(schemas[schemaName], jsonRefsOptions).then(schema => schema.resolved); | ||
} | ||
function validateJson(data, schema) { | ||
var Validator = require('jsonschema').Validator; | ||
// for some reason jsonschema doesn't like our date format | ||
Validator.prototype.customFormats.datetimezone = function(input) { | ||
return !input || !isNaN(Date.parse(input)); | ||
}; | ||
var v = new Validator(); | ||
var results = (v.validate(data, schema)); | ||
return results.errors.map(function (obj) { | ||
return obj.stack; | ||
}); | ||
// for some reason jsonschema doesn't like our date format | ||
Validator.prototype.customFormats.datetimezone = function datetimezone(input) { | ||
return !input || !isNaN(Date.parse(input)); | ||
}; | ||
const v = new Validator(); | ||
const results = (v.validate(data, schema)); | ||
return results.errors.map(obj => obj.stack); | ||
} | ||
module.exports = { | ||
getSchema, | ||
validateJson | ||
getSchema, | ||
validateJson, | ||
}; |
@@ -1,20 +0,18 @@ | ||
"use strict"; | ||
const EntityMap = require('./entitymap'); | ||
const SchemaProcessing = require('./schemaprocessing'); | ||
const Targeting = require('./common/targeting'); | ||
var EntityMap = require('./entitymap'); | ||
var SchemaProcessing = require('./schemaprocessing'); | ||
var Targeting = require('./common/targeting'); | ||
const StrategyAudienceSegments = function StrategyAudienceSegments(connection, id) { | ||
Targeting.call(this, | ||
'?with=strategy_audience_segments&full=strategy_audience_segments', | ||
'audience_segments', | ||
id); | ||
this.include = []; | ||
this.exclude = []; | ||
this.include_op = ''; | ||
this.exclude_op = ''; | ||
var StrategyAudienceSegments = function (connection, id) { | ||
Targeting.call(this, | ||
"?with=strategy_audience_segments&full=strategy_audience_segments", | ||
"audience_segments", | ||
id); | ||
this.include = []; | ||
this.exclude = []; | ||
this.include_op = ''; | ||
this.exclude_op = ''; | ||
if (connection) { | ||
this.get(id, connection); | ||
} | ||
if (connection) { | ||
this.get(id, connection); | ||
} | ||
}; | ||
@@ -25,71 +23,69 @@ | ||
// called on successful get/save | ||
StrategyAudienceSegments.prototype.updateTargeting = function (data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
this.include = []; | ||
this.exclude = []; | ||
var that = this; | ||
StrategyAudienceSegments.prototype.updateTargeting = function updateTargeting(data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
this.include = []; | ||
this.exclude = []; | ||
const that = this; | ||
if (data.hasOwnProperty('audience_segment_include_op')) { | ||
that.include_op = data.audience_segment_include_op; | ||
} | ||
if (data.hasOwnProperty('audience_segment_exclude_op')) { | ||
that.exclude_op = data.audience_segment_exclude_op; | ||
} | ||
if (Object.prototype.hasOwnProperty.call(data, 'audience_segment_include_op')) { | ||
that.include_op = data.audience_segment_include_op; | ||
} | ||
if (Object.prototype.hasOwnProperty.call(data, 'audience_segment_exclude_op')) { | ||
that.exclude_op = data.audience_segment_exclude_op; | ||
} | ||
if (data.hasOwnProperty('strategy_audience_segments')) { | ||
Array.from(data.strategy_audience_segments).forEach(function (target) { | ||
that[target.restriction.toLowerCase()] | ||
.push(target.audience_segment_id); | ||
}); | ||
} | ||
if (Object.prototype.hasOwnProperty.call(data, 'strategy_audience_segments')) { | ||
Array.from(data.strategy_audience_segments).forEach((target) => { | ||
that[target.restriction.toLowerCase()] | ||
.push(target.audience_segment_id); | ||
}); | ||
} | ||
return this; | ||
return this; | ||
}; | ||
StrategyAudienceSegments.prototype.getCpmEstimate = function (connection) { | ||
var that = this; | ||
StrategyAudienceSegments.prototype.getCpmEstimate = function getCpmEstimate(connection) { | ||
const that = this; | ||
return that._generateForm() | ||
.then(function (form) { | ||
var endpoint = EntityMap.getEndpoint("strategy") + "/" + | ||
that.strategy_id + "/audience_segments/cpm"; | ||
return that.generateForm() | ||
.then((form) => { | ||
const endpoint = `${EntityMap.getEndpoint('strategy')}/${that.strategy_id}/audience_segments/cpm`; | ||
return connection.postFormdata(endpoint, form).then(function (body) { | ||
that.price_estimate = JSON.parse(body).data.prop[0]; | ||
return that; | ||
}); | ||
}); | ||
return connection.postFormdata(endpoint, form).then((body) => { | ||
that.price_estimate = JSON.parse(body).data.prop[0]; | ||
return that; | ||
}); | ||
}); | ||
}; | ||
StrategyAudienceSegments.prototype._generateForm = function () { | ||
var that = this; | ||
return SchemaProcessing.getSchema('strategy_audience_segment_form') | ||
.then(function (schema) { | ||
var verification = SchemaProcessing.validateJson(that, schema); | ||
if (verification.length !== 0) { | ||
throw new Error(verification); | ||
} | ||
else { | ||
var form = { | ||
include_op: that.include_op, | ||
exclude_op: that.exclude_op | ||
}; | ||
StrategyAudienceSegments.prototype.generateForm = function generateForm() { | ||
const that = this; | ||
return SchemaProcessing.getSchema('strategy_audience_segment_form') | ||
.then((schema) => { | ||
const verification = SchemaProcessing.validateJson(that, schema); | ||
if (verification.length !== 0) { | ||
throw new Error(verification); | ||
} else { | ||
const form = { | ||
include_op: that.include_op, | ||
exclude_op: that.exclude_op, | ||
}; | ||
var target_index = 1; | ||
that.include.forEach(function (segment_id) { | ||
form['segments.' + target_index + '.id'] = segment_id; | ||
form['segments.' + target_index + '.restriction'] = 'INCLUDE'; | ||
target_index++; | ||
}); | ||
let target_index = 1; | ||
that.include.forEach((segment_id) => { | ||
form[`segments.${target_index}.id`] = segment_id; | ||
form[`segments.${target_index}.restriction`] = 'INCLUDE'; | ||
target_index += 1; | ||
}); | ||
that.exclude.forEach(function (segment_id) { | ||
form['segments.' + target_index + '.id'] = segment_id; | ||
form['segments.' + target_index + '.restriction'] = 'EXCLUDE'; | ||
target_index++; | ||
}); | ||
that.exclude.forEach((segment_id) => { | ||
form[`segments.${target_index}.id`] = segment_id; | ||
form[`segments.${target_index}.restriction`] = 'EXCLUDE'; | ||
target_index += 1; | ||
}); | ||
return form; | ||
} | ||
}); | ||
return form; | ||
} | ||
}); | ||
}; | ||
@@ -96,0 +92,0 @@ |
@@ -1,16 +0,14 @@ | ||
"use strict"; | ||
const EntityMap = require('./entitymap'); | ||
const SchemaProcessing = require('./schemaprocessing'); | ||
const Targeting = require('./common/targeting'); | ||
var EntityMap = require('./entitymap'); | ||
var SchemaProcessing = require('./schemaprocessing'); | ||
var Targeting = require('./common/targeting'); | ||
var StrategyTargetSegments = function (id) { | ||
Targeting.call(this, | ||
"?with=strategy_targeting_segments&full=strategy_targeting_segment", | ||
"targeting_segments", | ||
id); | ||
this.include = []; | ||
this.exclude = []; | ||
this.include_op = ''; | ||
this.exclude_op = ''; | ||
const StrategyTargetSegments = function StrategyTargetSegments(id) { | ||
Targeting.call(this, | ||
'?with=strategy_targeting_segments&full=strategy_targeting_segment', | ||
'targeting_segments', | ||
id); | ||
this.include = []; | ||
this.exclude = []; | ||
this.include_op = ''; | ||
this.exclude_op = ''; | ||
}; | ||
@@ -21,74 +19,71 @@ | ||
// called on successful get/save | ||
StrategyTargetSegments.prototype.updateTargeting = function (data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
this.include = []; | ||
this.exclude = []; | ||
var that = this; | ||
StrategyTargetSegments.prototype.updateTargeting = function updateTargeting(data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
this.include = []; | ||
this.exclude = []; | ||
const that = this; | ||
if (data.hasOwnProperty('targeting_segment_include_op')) { | ||
that.include_op = data.targeting_segment_include_op; | ||
} | ||
if (data.hasOwnProperty('targeting_segment_exclude_op')) { | ||
that.exclude_op = data.targeting_segment_include_op; | ||
} | ||
if (Object.prototype.hasOwnProperty.call(data, 'targeting_segment_include_op')) { | ||
that.include_op = data.targeting_segment_include_op; | ||
} | ||
if (Object.prototype.hasOwnProperty.call(data, 'targeting_segment_exclude_op')) { | ||
that.exclude_op = data.targeting_segment_include_op; | ||
} | ||
if (data.hasOwnProperty('strategy_targeting_segments')) { | ||
Array.from(data.strategy_targeting_segments).forEach(function (target) { | ||
that[target.restriction.toLowerCase()] | ||
.push([target.targeting_segment_id, target.operator]); | ||
}); | ||
} | ||
if (Object.prototype.hasOwnProperty.call(data, 'strategy_targeting_segments')) { | ||
Array.from(data.strategy_targeting_segments).forEach((target) => { | ||
that[target.restriction.toLowerCase()] | ||
.push([target.targeting_segment_id, target.operator]); | ||
}); | ||
} | ||
return this; | ||
return this; | ||
}; | ||
StrategyTargetSegments.prototype.getCpmEstimate = function (connection) { | ||
var that = this; | ||
StrategyTargetSegments.prototype.getCpmEstimate = function getCpmEstimate(connection) { | ||
const that = this; | ||
return that._generateForm() | ||
.then(function (form) { | ||
var endpoint = EntityMap.getEndpoint("strategy") + "/" + | ||
that.strategy_id + "/targeting_segments/cpm"; | ||
return that.generateForm() | ||
.then((form) => { | ||
const endpoint = `${EntityMap.getEndpoint('strategy')}/${that.strategy_id}/targeting_segments/cpm`; | ||
return connection.postFormdata(endpoint, form).then(function (body) { | ||
that.price_estimate = JSON.parse(body).data.prop[0]; | ||
return that; | ||
}); | ||
}); | ||
return connection.postFormdata(endpoint, form).then((body) => { | ||
that.price_estimate = JSON.parse(body).data.prop[0]; | ||
return that; | ||
}); | ||
}); | ||
}; | ||
StrategyTargetSegments.prototype._generateForm = function () { | ||
var that = this; | ||
return SchemaProcessing.getSchema('strategy_targeting_segment_form') | ||
.then(function (schema) { | ||
var verification = SchemaProcessing.validateJson(that, schema); | ||
if (verification.length !== 0) { | ||
throw new Error(verification); | ||
} | ||
else { | ||
var form = { | ||
include_op: that.include_op, | ||
exclude_op: that.exclude_op | ||
}; | ||
StrategyTargetSegments.prototype.generateForm = function generateForm() { | ||
const that = this; | ||
return SchemaProcessing.getSchema('strategy_targeting_segment_form') | ||
.then((schema) => { | ||
const verification = SchemaProcessing.validateJson(that, schema); | ||
if (verification.length !== 0) { | ||
throw new Error(verification); | ||
} else { | ||
const form = { | ||
include_op: that.include_op, | ||
exclude_op: that.exclude_op, | ||
}; | ||
var target_index = 1; | ||
that.include.forEach(function (tuple) { | ||
form['segments.' + target_index + '.id'] = tuple[0]; | ||
form['segments.' + target_index + '.operator'] = tuple[1]; | ||
form['segments.' + target_index + '.restriction'] = 'INCLUDE'; | ||
target_index++; | ||
}); | ||
let target_index = 1; | ||
that.include.forEach((tuple) => { | ||
form[`segments.${target_index}.id`] = tuple[0]; | ||
form[`segments.${target_index}.operator`] = tuple[1]; | ||
form[`segments.${target_index}.restriction`] = 'INCLUDE'; | ||
target_index += 1; | ||
}); | ||
that.exclude.forEach((tuple) => { | ||
form[`segments.${target_index}.id`] = tuple[0]; | ||
form[`segments.${target_index}.operator`] = tuple[1]; | ||
form[`segments.${target_index}.restriction`] = 'EXCLUDE'; | ||
target_index += 1; | ||
}); | ||
that.exclude.forEach(function (tuple) { | ||
form['segments.' + target_index + '.id'] = tuple[0]; | ||
form['segments.' + target_index + '.operator'] = tuple[1]; | ||
form['segments.' + target_index + '.restriction'] = 'EXCLUDE'; | ||
target_index++; | ||
}); | ||
return form; | ||
} | ||
}); | ||
return form; | ||
} | ||
}); | ||
}; | ||
@@ -95,0 +90,0 @@ |
@@ -1,14 +0,11 @@ | ||
"use strict"; | ||
const SchemaProcessing = require('./schemaprocessing'); | ||
const Targeting = require('./common/targeting'); | ||
var SchemaProcessing = require('./schemaprocessing'); | ||
var Targeting = require('./common/targeting'); | ||
var StrategyTargetValues = function (id) { | ||
Targeting.call(this, | ||
"target_values?full=*", | ||
"target_values", | ||
id); | ||
this.dimensions = []; | ||
const StrategyTargetValues = function StrategyTargetValues(id) { | ||
Targeting.call(this, | ||
'target_values?full=*', | ||
'target_values', | ||
id); | ||
this.dimensions = []; | ||
}; | ||
@@ -20,51 +17,50 @@ | ||
// called on successful get/save | ||
StrategyTargetValues.prototype.updateTargeting = function (data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
this.dimensions = []; | ||
var that = this; | ||
data.forEach(function (dimension) { | ||
var dim = {}; | ||
dim.code = dimension.target_dimension.code; | ||
dim.operation = dimension.target_op; | ||
dim.restriction = dimension.exclude ? "EXCLUDE" : "INCLUDE"; | ||
dim.value_ids = dimension.target_values.map(function (t) {return t.id;}); | ||
that.dimensions.push(dim); | ||
}); | ||
return this; | ||
StrategyTargetValues.prototype.updateTargeting = function updateTargeting(data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
this.dimensions = []; | ||
const that = this; | ||
data.forEach((dimension) => { | ||
const dim = {}; | ||
dim.code = dimension.target_dimension.code; | ||
dim.operation = dimension.target_op; | ||
dim.restriction = dimension.exclude ? 'EXCLUDE' : 'INCLUDE'; | ||
dim.value_ids = dimension.target_values.map(t => t.id); | ||
that.dimensions.push(dim); | ||
}); | ||
return this; | ||
}; | ||
StrategyTargetValues.prototype.addTargetValues = function (code, restriction, | ||
operator, values) { | ||
var dimension = { | ||
code: code, | ||
restriction: restriction, | ||
operation: operator, | ||
value_ids: values | ||
}; | ||
StrategyTargetValues.prototype.addTargetValues = function addTargetValues(code, restriction, | ||
operator, values) { | ||
const dimension = { | ||
code, | ||
restriction, | ||
operation: operator, | ||
value_ids: values, | ||
}; | ||
this.dimensions.push(dimension); | ||
this.dimensions.push(dimension); | ||
}; | ||
StrategyTargetValues.prototype._generateForm = function () { | ||
var that = this; | ||
return SchemaProcessing.getSchema('strategy_target_values_form') | ||
.then(function (schema) { | ||
var verification = SchemaProcessing.validateJson(that, schema); | ||
if (verification.length !== 0) { | ||
throw new Error(verification); | ||
} | ||
else { | ||
var form = {}; | ||
StrategyTargetValues.prototype.generateForm = function generateForm() { | ||
const that = this; | ||
return SchemaProcessing.getSchema('strategy_target_values_form') | ||
.then((schema) => { | ||
const verification = SchemaProcessing.validateJson(that, schema); | ||
if (verification.length !== 0) { | ||
throw new Error(verification); | ||
} else { | ||
const form = {}; | ||
that.dimensions.forEach(function (dimension, target_index) { | ||
target_index++; | ||
form['dimensions.' + target_index + '.code'] = dimension.code; | ||
form['dimensions.' + target_index + '.operation'] = dimension.operation; | ||
form['dimensions.' + target_index + '.restriction'] = dimension.restriction; | ||
form['dimensions.' + target_index + '.value_ids'] = dimension.value_ids.join(','); | ||
}); | ||
return form; | ||
} | ||
that.dimensions.forEach((dimension, target_index) => { | ||
target_index += 1; | ||
form[`dimensions.${target_index}.code`] = dimension.code; | ||
form[`dimensions.${target_index}.operation`] = dimension.operation; | ||
form[`dimensions.${target_index}.restriction`] = dimension.restriction; | ||
form[`dimensions.${target_index}.value_ids`] = dimension.value_ids.join(','); | ||
}); | ||
return form; | ||
} | ||
}); | ||
}; | ||
@@ -71,0 +67,0 @@ |
@@ -1,37 +0,35 @@ | ||
"use strict"; | ||
const RequestPromise = require('request-promise'); | ||
const QueryString = require('querystring'); | ||
const BPromise = require('bluebird'); | ||
const OauthService = require('simple-oauth2'); | ||
const pkg = require('../package.json'); | ||
var RequestPromise = require('request-promise'); | ||
var QueryString = require('querystring'); | ||
var BPromise = require('bluebird'); | ||
var OauthService = require('simple-oauth2'); | ||
var T1Connection = function(t1config) { | ||
const T1Connection = function T1Connection(t1config) { | ||
this.t1config = t1config; | ||
this.baseUrl = t1config.baseUrl || 'https://api.mediamath.com/'; | ||
var pkg = require('../package.json'); | ||
this.requestHeaders = { | ||
'Accept': 'application/vnd.mediamath.v1+json', | ||
'User-Agent': pkg.name + '-node/' + pkg.version | ||
Accept: 'application/vnd.mediamath.v1+json', | ||
'User-Agent': `${pkg.name}-node/${pkg.version}`, | ||
}; | ||
}; | ||
T1Connection.prototype.ensureAuthenticated = function() { | ||
var that = this; | ||
return BPromise.try(function() { | ||
T1Connection.prototype.ensureAuthenticated = function ensureAuthenticated() { | ||
const that = this; | ||
return BPromise.try(() => { | ||
if (!that.requestHeaders.adama_session || !that.requestHeaders.Authorization) { | ||
if (that.t1config.preferCookieAuth !== true) { | ||
if (that.t1config.preferCookieAuth === false) { | ||
return that.getOAuthToken(); | ||
} else { | ||
return that.getCookieSession(); | ||
} | ||
return that.getCookieSession(); | ||
} | ||
return true; | ||
}); | ||
}; | ||
T1Connection.prototype.getCookieSession = function() { | ||
var that = this; | ||
T1Connection.prototype.getCookieSession = function getCookieSession() { | ||
const that = this; | ||
let request = RequestPromise.post({ | ||
return RequestPromise.post({ | ||
jar: true, | ||
url: this.baseUrl + 'api/v2.0/login', | ||
url: `${this.baseUrl}api/v2.0/login`, | ||
headers: that.requestHeaders, | ||
@@ -42,27 +40,24 @@ withCredentials: true, | ||
password: that.t1config.password, | ||
api_key: that.t1config.api_key | ||
} | ||
}).then(function(result) { | ||
return JSON.parse(result); | ||
}).catch(function(error) { | ||
console.error('a connection error occurred: ' + error.message); | ||
api_key: that.t1config.api_key, | ||
}, | ||
}).then(result => JSON.parse(result)).catch((error) => { | ||
console.error(`a connection error occurred: ${error.message}`); | ||
}); | ||
return request; | ||
}; | ||
T1Connection.prototype.getOAuthToken = function() { | ||
var that = this; | ||
T1Connection.prototype.getOAuthToken = function getOAuthToken() { | ||
const that = this; | ||
let credentials = { | ||
const credentials = { | ||
client: { | ||
id: this.t1config.client_id, | ||
secret: this.t1config.client_secret | ||
secret: this.t1config.client_secret, | ||
}, | ||
auth: { | ||
tokenHost: 'https://sso.mediamath.auth0.com', | ||
tokenPath: '/oauth/token' | ||
tokenPath: '/oauth/token', | ||
}, | ||
options: { | ||
useBasicAuthorizationHeader: false | ||
} | ||
useBasicAuthorizationHeader: false, | ||
}, | ||
}; | ||
@@ -73,8 +68,8 @@ if (that.t1config.environment === 'dev') { | ||
let tokenConfig = { | ||
const tokenConfig = { | ||
username: that.t1config.user, | ||
password: that.t1config.password, | ||
scope: 'openid profile' | ||
scope: 'openid profile', | ||
}; | ||
var OAuthConnection = OauthService.create(credentials); | ||
const OAuthConnection = OauthService.create(credentials); | ||
return OAuthConnection.ownerPassword | ||
@@ -84,8 +79,8 @@ .getToken(tokenConfig) | ||
const token = OAuthConnection.accessToken.create(result); | ||
that.requestHeaders.Authorization = 'Bearer ' + token.token.id_token; | ||
that.requestHeaders.Authorization = `Bearer ${token.token.id_token}`; | ||
}); | ||
}; | ||
T1Connection.prototype.copyHeaders = function(source, sink) { | ||
Object.keys(source).forEach(function(key) { | ||
T1Connection.prototype.copyHeaders = function copyHeaders(source, sink) { | ||
Object.keys(source).forEach((key) => { | ||
sink[key] = source[key]; | ||
@@ -95,92 +90,84 @@ }); | ||
T1Connection.prototype.get = function(endpoint) { | ||
T1Connection.prototype.get = function get(endpoint) { | ||
let url = endpoint; | ||
// Check if there's a full path going in here, and fix it. | ||
if (endpoint.includes(this.baseUrl)) { | ||
endpoint = endpoint.substring(this.baseUrl.length, endpoint.length); | ||
url = endpoint.substring(this.baseUrl.length, endpoint.length); | ||
} | ||
var options = { | ||
const options = { | ||
jar: true, | ||
headers: this.requestHeaders, | ||
url: this.baseUrl + endpoint, | ||
withCredentials: true | ||
url: this.baseUrl + url, | ||
withCredentials: true, | ||
}; | ||
return this.ensureAuthenticated() | ||
.then(function() { | ||
return RequestPromise.get(options); | ||
}); | ||
.then(() => RequestPromise.get(options)); | ||
}; | ||
T1Connection.prototype.getSession = function() { | ||
T1Connection.prototype.getSession = function getSession() { | ||
return this.get('session'); | ||
}; | ||
T1Connection.prototype.postFormdata = function (endpoint, form) { | ||
var formdata = QueryString.stringify(form); | ||
var contentLength = formdata.length; | ||
var postHeaders = { | ||
'Content-Length': contentLength, | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
}; | ||
return this._post(endpoint, postHeaders, formdata); | ||
T1Connection.prototype.postFormdata = function postFormdata(endpoint, form) { | ||
const formdata = QueryString.stringify(form); | ||
const contentLength = formdata.length; | ||
const postHeaders = { | ||
'Content-Length': contentLength, | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
}; | ||
return this.post(endpoint, postHeaders, formdata); | ||
}; | ||
T1Connection.prototype.postJson = function (endpoint, json) { | ||
var postHeaders = { | ||
'Content-Type': 'application/json' | ||
}; | ||
return this._post(endpoint, postHeaders, json); | ||
T1Connection.prototype.postJson = function postJson(endpoint, json) { | ||
const postHeaders = { | ||
'Content-Type': 'application/json', | ||
}; | ||
return this.post(endpoint, postHeaders, json); | ||
}; | ||
T1Connection.prototype._post = function (endpoint, headers, data) { | ||
var that = this; | ||
if (this.oauth2Token) { | ||
headers.Authorization = 'Bearer ' + this.oauth2Token.token.access_token; | ||
} | ||
this.copyHeaders(this.requestHeaders, headers); | ||
return this.ensureAuthenticated() | ||
.then(function () { | ||
return RequestPromise.post({ | ||
jar: true, | ||
withCredentials: true, | ||
headers: headers, | ||
url: that.t1config.apiBaseUrl + endpoint, | ||
body: data | ||
} | ||
); | ||
}); | ||
T1Connection.prototype.post = function post(endpoint, headers, data) { | ||
const that = this; | ||
const requestHeaders = headers; | ||
if (this.oauth2Token) { | ||
requestHeaders.Authorization = `Bearer ${this.oauth2Token.token.access_token}`; | ||
} | ||
this.copyHeaders(this.requestHeaders, headers); | ||
return this.ensureAuthenticated() | ||
.then(() => RequestPromise.post({ | ||
jar: true, | ||
withCredentials: true, | ||
headers: requestHeaders, | ||
url: that.baseUrl + endpoint, | ||
body: data, | ||
})); | ||
}; | ||
T1Connection.prototype.buildQueryString = function(baseUrl, userParams) { | ||
var endpoint = baseUrl; | ||
if (!userParams) { | ||
userParams = {}; | ||
T1Connection.prototype.buildQueryString = function buildQueryString(baseUrl, userParams) { | ||
let endpoint = baseUrl; | ||
let queryParams = userParams; | ||
if (!queryParams) { | ||
queryParams = {}; | ||
} | ||
userParams.api_key = this.t1config.api_key !== undefined ? this.t1config.api_key : 'noapikey'; | ||
queryParams.api_key = this.t1config.api_key !== undefined ? this.t1config.api_key : 'noapikey'; | ||
var urlParams = []; | ||
if (userParams.limit !== undefined) { | ||
var entity = Object.keys(userParams.limit)[0]; | ||
endpoint += ('/limit/' + entity + | ||
'=' + userParams.limit[entity]); | ||
const urlParams = []; | ||
if (queryParams.limit !== undefined) { | ||
const entity = Object.keys(queryParams.limit)[0]; | ||
endpoint += (`/limit/${entity}=${queryParams.limit[entity]}`); | ||
} | ||
for (var p in userParams) { | ||
if (!userParams.hasOwnProperty(p)) { | ||
continue; | ||
} | ||
Object.keys(queryParams).forEach((p) => { | ||
if (p === 'limit') { | ||
//skip | ||
// skip | ||
} else if (p === 'with') { | ||
urlParams.push(userParams[p].map(function(i) { | ||
return 'with=' + i; | ||
}).join('&')); | ||
urlParams.push(queryParams[p].map(i => `with=${i}`).join('&')); | ||
} else { | ||
urlParams.push(encodeURIComponent(p) + '=' + encodeURIComponent(userParams[p])); | ||
urlParams.push(`${encodeURIComponent(p)}=${encodeURIComponent(queryParams[p])}`); | ||
} | ||
} | ||
}); | ||
if (Object.keys(userParams).length > 0) { | ||
endpoint += '?' + urlParams.join('&'); | ||
if (Object.keys(queryParams).length > 0) { | ||
endpoint += `?${urlParams.join('&')}`; | ||
} | ||
@@ -187,0 +174,0 @@ |
@@ -1,23 +0,26 @@ | ||
var TargetSegments = function (connection) { | ||
this.data = {}; | ||
this.meta = {}; | ||
if (connection) { | ||
this.get(connection); | ||
} | ||
const TargetSegments = function TargetSegments(connection) { | ||
this.data = {}; | ||
this.meta = {}; | ||
if (connection) { | ||
this.get(connection); | ||
} | ||
}; | ||
TargetSegments.prototype.get = function (connection, parentId) { | ||
if (connection) { | ||
var that = this; | ||
var endpoint = "/targeting_segments?full=*"; | ||
if (parentId) { | ||
endpoint += '&parent=' + parentId; | ||
} | ||
return connection.get(endpoint) | ||
.then(function (body) { | ||
var content = JSON.parse(body); | ||
return that.updateTargeting(content.data, content.meta); | ||
}); | ||
TargetSegments.prototype.get = function get(connection, parentId) { | ||
if (connection) { | ||
const that = this; | ||
let endpoint = '/targeting_segments?full=*'; | ||
if (parentId) { | ||
endpoint += `&parent=${parentId}`; | ||
} | ||
return connection.get(endpoint) | ||
.then((body) => { | ||
const content = JSON.parse(body); | ||
return that.updateTargeting(content.data, content.meta); | ||
}); | ||
} | ||
throw new Error('connection object must be provided'); | ||
}; | ||
@@ -27,13 +30,12 @@ | ||
// called on successful get/save | ||
TargetSegments.prototype.updateTargeting = function (data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
return this; | ||
TargetSegments.prototype.updateTargeting = function updateTargeting(data, meta) { | ||
this.data = data; | ||
this.meta = meta; | ||
return this; | ||
}; | ||
TargetSegments.prototype.save = function (connection) { | ||
console.info('updating targeting segments is not implemented'); | ||
TargetSegments.prototype.save = function save() { | ||
console.info('updating targeting segments is not implemented'); | ||
}; | ||
module.exports = TargetSegments; |
@@ -5,5 +5,5 @@ { | ||
"license": "Apache-2.0", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"engines": { | ||
"node": ">= 0.12" | ||
"node": ">= 4.0.0" | ||
}, | ||
@@ -17,23 +17,37 @@ "engine-strict": true, | ||
"devDependencies": { | ||
"chai": "3.5.0", | ||
"chai-as-promised": "~6.0.0", | ||
"jshint": "^2.9.1", | ||
"mocha": "3.4.1", | ||
"sinon": "2.2.0", | ||
"sinon-chai": "2.10.0", | ||
"chai": "^4.1.2", | ||
"chai-as-promised": "^7.0.0", | ||
"codacy-coverage": "^2.1.1", | ||
"eslint": "^3.19.0", | ||
"eslint-config-airbnb-base": "^11.3.2", | ||
"eslint-plugin-import": "^2.12.0", | ||
"eslint-plugin-mocha": "^4.12.1", | ||
"fast-deep-equal": "^1.1.0", | ||
"istanbul": "^0.4.5", | ||
"dotenv": "^4.0.0" | ||
"mocha": "^3.5.3", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"nyc": "^11.8.0", | ||
"sinon": "^2.4.1", | ||
"sinon-chai": "^2.14.0" | ||
}, | ||
"dependencies": { | ||
"babyparse": "^0.4.6", | ||
"bluebird": "^3.3.4", | ||
"bluebird": "^3.5.1", | ||
"dotenv": "^4.0.0", | ||
"json-refs": "3.0.0", | ||
"jsonschema": "^1.1.0", | ||
"jsonschema": "^1.2.4", | ||
"querystring": "^0.2.0", | ||
"request-promise": "4.2.1", | ||
"simple-oauth2": "^1.0.0" | ||
"simple-oauth2": "^1.5.2" | ||
}, | ||
"nyc": { | ||
"exclude": [ | ||
"lib/schema", | ||
"test" | ||
] | ||
}, | ||
"scripts": { | ||
"lint": "jshint lib/**.js", | ||
"test": "mocha test", | ||
"lint": "eslint lib test integration-test", | ||
"test": "nyc mocha", | ||
"coverage-report": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/.bin/codacy-coverage && rm -rf ./coverage", | ||
"integration": "mocha integration-test", | ||
@@ -40,0 +54,0 @@ "posttest": "npm run lint" |
t1-node | ||
======= | ||
[](https://www.codacy.com/app/fsargent/t1-node?utm_source=github.com&utm_medium=referral&utm_content=MediaMath/t1-node&utm_campaign=badger) | ||
[](https://travis-ci.org/MediaMath/t1-node) | ||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FMediaMath%2Ft1-node?ref=badge_shield) | ||
Node implementation of a T1 API Library. Uses [Bluebird](http://bluebirdjs.com/docs/getting-started.html) for fast, simple callback handling via promises. | ||
@@ -14,9 +18,20 @@ | ||
For cookie authentication: | ||
T1 Node uses dotenv for easy management of environment variables. Copy .env.template to .env and fill in your details. | ||
To get an API key, see https://apidocs.mediamath.com | ||
# Cookie Authentication (default): | ||
Required Env variables: | ||
`T1_API_USERNAME` | ||
`T1_API_PASSWORD` | ||
`T1_API_KEY` | ||
``` js | ||
var t1 = require('@mediamath/terminalone'); | ||
var config = { | ||
'user': t1_username, | ||
'password': t1_user_password, | ||
'api_key': application_mashery_key | ||
preferCookieAuth: true, | ||
user: process.env.T1_API_USERNAME, | ||
password: process.env.T1_API_PASSWORD, | ||
api_key: process.env.T1_API_KEY | ||
}; | ||
@@ -26,29 +41,20 @@ var connection = new t1.T1Connection(config); | ||
For oauth2 authentication, your web application will need to redirect to the T1 user authentication page during the process. The approach is outlined below: | ||
## OAuth2 (Password - Resource Owner flow): | ||
``` js | ||
var t1 = require('@mediamath/terminalone'); | ||
//the callback URL should match the one you specified in the developer portal for your application | ||
var config = { | ||
'api_key': application_mashery_key, | ||
'client_secret': application_mashery_secret, | ||
'redirect_uri': application_callback_url | ||
} | ||
T1 Node is designed to be used for scripts. If you wish to make a UI for 3rd parties, we recommend use use the Application Code flow, which may require a little more engineering than what's covered here. | ||
Note: As of 2017-06-29 OAuth2 is not available everywhere within the MediaMath environment. Until then, for production, we recommend using the Cookie flow. This message will be updated with more services as the rollout completes. | ||
``` | ||
t1conf = { | ||
preferCookieAuth: false, | ||
user: process.env.T1_API_USERNAME, | ||
password: process.env.T1_API_PASSWORD, | ||
client_id: process.env.T1_CLIENT_ID, | ||
client_secret: process.env.T1_CLIENT_SECRET, | ||
}; | ||
var connection = new t1.T1Connection(config); | ||
``` | ||
// tokenUpdatedCallback is an optional callback to a function, taking | ||
// a single argument which describes an access token. | ||
// This can be used update your token databse on automatic token refresh. | ||
var authorizationUrl = connection.fetchAuthUrl(tokenUpdatedCallback); | ||
// Redirect example using Express (see http://expressjs.com/api.html#res.redirect) | ||
res.redirect(authorizationUri); | ||
var code = // Get the access token object (the authorization code is given from the previous step). | ||
connection.getToken(code) | ||
.then(console.log('oauth complete')); | ||
``` | ||
#### Single Entities | ||
@@ -208,2 +214,19 @@ | ||
`npm run integration` will run integration tests with Mocha. | ||
`npm run integration` will run integration tests with Mocha. | ||
## FAQ | ||
**The EntityList I requested has an empty `entities` object but the metadata has a nonzero count! What gives?** | ||
t1-node returns an ES6 generator for the `entities` property, which looks like an empty object if you inspect it in the node REPL. | ||
You can iterate over it using `for (let ... of)`, or simply call `entities.next().value` to get each entity. | ||
[Check out the Mozilla documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators) for more information on iterators and generators. | ||
**There's a feature that isn't supported yet! Can you add it?** | ||
Yep! Please check the [open issues](https://github.com/MediaMath/t1-node/issues) to see if this is already a known problem or request. | ||
If it is, we'd love to hear your comments and ideas on how best to approach it. If not, please [create an issue](https://github.com/MediaMath/t1-node/issues/new). Alternatively, consider contributing to the project! | ||
**I want to contribute! Is that OK?** | ||
Yes! PRs are more than welcome. Please review the [contributing guidelines](CONTRIBUTING.md) on how best to go about this. |
@@ -1,4 +0,4 @@ | ||
var chai = require('chai'); | ||
var chaiAsPromised = require('chai-as-promised'); | ||
var sinonChai = require('sinon-chai'); | ||
const chai = require('chai'); | ||
const chaiAsPromised = require('chai-as-promised'); | ||
const sinonChai = require('sinon-chai'); | ||
@@ -5,0 +5,0 @@ chai.config.includeStack = true; |
@@ -1,116 +0,102 @@ | ||
var BPromise = require('bluebird'); | ||
var expect = require('./chai_config').expect; | ||
var sinon = require('sinon'); | ||
var t1 = require('../index'); | ||
var common = require('./test-common.js'); | ||
'use strict'; // eslint-disable-line | ||
describe("entity", function () { | ||
const BPromise = require('bluebird'); | ||
const expect = require('./chai_config').expect; | ||
const sinon = require('sinon'); | ||
const t1 = require('../index'); | ||
const common = require('./test-common.js'); | ||
var connectionStub = {}; | ||
connectionStub.get = function () { | ||
}; | ||
connectionStub.post = function () { | ||
}; | ||
connectionStub.buildQueryString = function () { | ||
return ""; | ||
}; | ||
var sandbox, getStub, postStub; | ||
var parsedResult = "aisdaiusd"; | ||
describe('entity', () => { | ||
const connectionStub = {}; | ||
connectionStub.get = function get() { | ||
}; | ||
connectionStub.post = function post() { | ||
}; | ||
connectionStub.buildQueryString = function buildQueryString() { | ||
return ''; | ||
}; | ||
let sandbox; | ||
let parsedResult = 'aisdaiusd'; | ||
beforeEach(function () { | ||
sandbox = sinon.sandbox.create(); | ||
getStub = sandbox.stub(connectionStub, "get").returns(BPromise.try(function () { | ||
return parsedResult; | ||
})); | ||
postStub = sandbox.stub(connectionStub, "post").returns(BPromise.try(function () { | ||
return parsedResult; | ||
})); | ||
}); | ||
beforeEach(() => { | ||
sandbox = sinon.sandbox.create(); | ||
sandbox.stub(connectionStub, 'get').returns(BPromise.try(() => parsedResult)); | ||
sandbox.stub(connectionStub, 'post').returns(BPromise.try(() => parsedResult)); | ||
}); | ||
afterEach(function () { | ||
sandbox.restore(); | ||
}); | ||
afterEach(() => { | ||
sandbox.restore(); | ||
}); | ||
describe("#get single campaign", function () { | ||
parsedResult = common.loadFixture('campaign'); | ||
describe('#get single campaign', () => { | ||
parsedResult = common.loadFixture('campaign'); | ||
var campaign = new t1.Entity('campaign'); | ||
let campaign = new t1.Entity('campaign'); | ||
it("should have a populated campaign entity", function () { | ||
campaign = campaign.get(10000, connectionStub); | ||
it('should have a populated campaign entity', () => { | ||
campaign = campaign.get(10000, connectionStub); | ||
return expect(campaign).to.eventually | ||
.have.property('id', 10000) && | ||
expect(campaign).to.eventually | ||
.have.property('entity_type', 'campaign'); | ||
}); | ||
return expect(campaign).to.eventually | ||
.have.property('id', 10000) && | ||
expect(campaign).to.eventually | ||
.have.property('entity_type', 'campaign'); | ||
}); | ||
}); | ||
describe("#get/set currency values", function () { | ||
var campaignData = JSON.parse(common.loadFixture('campaign')); | ||
describe('#get/set currency values', () => { | ||
const campaignData = JSON.parse(common.loadFixture('campaign')); | ||
var campaign = new t1.Entity('campaign'); | ||
const campaign = new t1.Entity('campaign'); | ||
campaign.processEntity(campaignData.data, campaignData.meta); | ||
campaign.processEntity(campaignData.data, campaignData.meta); | ||
it("should return the default currency value", function () { | ||
var amt = campaign.getCurrencyValue('goal_value'); | ||
it('should return the default currency value', () => { | ||
const amt = campaign.getCurrencyValue('goal_value'); | ||
return expect(amt).to.equal(campaign.goal_value[0].value); | ||
return expect(amt).to.equal(campaign.goal_value[0].value); | ||
}); | ||
}); | ||
it('should return the JPY currency value', () => { | ||
const amt = campaign.getCurrencyValue('goal_value', 'JPY'); | ||
return expect(amt).to.equal(campaign.goal_value[1].value); | ||
}); | ||
it("should return the JPY currency value", function () { | ||
var amt = campaign.getCurrencyValue('goal_value', 'JPY'); | ||
return expect(amt).to.equal(campaign.goal_value[1].value); | ||
}); | ||
it('should set the default currency value', () => { | ||
const newValue = 1; | ||
campaign.setCurrencyValue('goal_value', newValue); | ||
const changedAmt = campaign.getCurrencyValue('goal_value'); | ||
return expect(changedAmt).to.equal(newValue); | ||
}); | ||
it("should set the default currency value", function () { | ||
var newValue = 1; | ||
campaign.setCurrencyValue('goal_value', newValue); | ||
var changedAmt = campaign.getCurrencyValue('goal_value'); | ||
return expect(changedAmt).to.equal(newValue); | ||
it('should set the JPY currency value', () => { | ||
const newValue = 2; | ||
campaign.setCurrencyValue('goal_value', newValue, 'JPY'); | ||
const changedAmt = campaign.getCurrencyValue('goal_value', 'JPY'); | ||
return expect(changedAmt).to.equal(newValue); | ||
}); | ||
}); | ||
it("should set the JPY currency value", function () { | ||
var newValue = 2; | ||
campaign.setCurrencyValue('goal_value', newValue, 'JPY'); | ||
var changedAmt = campaign.getCurrencyValue('goal_value', 'JPY'); | ||
return expect(changedAmt).to.equal(newValue); | ||
}); | ||
it("should set a default currency value of a nonexistant field", function () { | ||
var newValue = 1; | ||
campaign.setCurrencyValue('some_new_value', newValue); | ||
var changedAmt = campaign.getCurrencyValue('some_new_value'); | ||
return expect(changedAmt).to.equal(newValue); | ||
}); | ||
it('should set a default currency value of a nonexistant field', () => { | ||
const newValue = 1; | ||
campaign.setCurrencyValue('some_new_value', newValue); | ||
const changedAmt = campaign.getCurrencyValue('some_new_value'); | ||
return expect(changedAmt).to.equal(newValue); | ||
}); | ||
}); | ||
describe("#generate post data", function () { | ||
var campaignData = JSON.parse(common.loadFixture('campaign')); | ||
describe('#generate post data', () => { | ||
const campaignData = JSON.parse(common.loadFixture('campaign')); | ||
var campaign = new t1.Entity('campaign'); | ||
const campaign = new t1.Entity('campaign'); | ||
campaign.processEntity(campaignData.data, campaignData.meta); | ||
campaign.processEntity(campaignData.data, campaignData.meta); | ||
it("should flatten currency data", function () { | ||
var amt = campaign.getCurrencyValue('goal_value'); | ||
var form = campaign._getPostFormData(); | ||
it('should flatten currency data', () => { | ||
const amt = campaign.getCurrencyValue('goal_value'); | ||
const form = campaign.getPostFormData(); | ||
return expect(form).to.eventually | ||
.have.property('goal_value', amt); | ||
}); | ||
return expect(form).to.eventually | ||
.have.property('goal_value', amt); | ||
}); | ||
}); | ||
}); | ||
@@ -1,70 +0,87 @@ | ||
"use strict"; | ||
var expect = require('./chai_config').expect; | ||
var sinon = require('sinon'); | ||
var common = require('./test-common'); | ||
var t1 = require('../index'); | ||
describe("entityList", function () { | ||
const expect = require('./chai_config').expect; | ||
const sinon = require('sinon'); | ||
const common = require('./test-common'); | ||
const t1 = require('../index'); | ||
var service = t1.EntityList; | ||
describe('entityList', () => { | ||
const service = t1.EntityList; | ||
var t1config = {}; | ||
const t1config = {}; | ||
class ConnectionStub { | ||
class ConnectionStub { | ||
get() { | ||
this.calls += 1; | ||
} | ||
get() { | ||
}; | ||
post() { | ||
this.calls += 1; | ||
return ''; | ||
} | ||
post() { | ||
return "" | ||
}; | ||
buildQueryString(base, userParams) { | ||
var t1Connection = new t1.T1Connection(t1config); | ||
return t1Connection.buildQueryString(base, userParams) | ||
}; | ||
buildQueryString(base, userParams) { | ||
this.calls += 1; | ||
const t1Connection = new t1.T1Connection(t1config); | ||
return t1Connection.buildQueryString(base, userParams); | ||
} | ||
} | ||
describe("#get with count", function () { | ||
var userParams = {'page_limit': 10}; | ||
describe('#get with count', () => { | ||
const userParams = { page_limit: 10 }; | ||
it("should have 10 entities", function () { | ||
let parsedResult = common.loadFixture('campaigns-10'); | ||
it('should have 10 entities', () => { | ||
const parsedResult = common.loadFixture('campaigns-10'); | ||
let conn = new ConnectionStub(); | ||
const conn = new ConnectionStub(); | ||
sinon.stub(conn, 'get') | ||
.resolves(parsedResult); | ||
sinon.stub(conn, 'get') | ||
.resolves(parsedResult); | ||
return service.get('campaigns', conn, userParams).then(function (data) { | ||
expect(data).to.have.property('meta') | ||
.and.have.property('count', userParams.page_limit); | ||
expect(conn.get.called).to.equal(true); | ||
expect(conn.get.getCall(0).args[0]).equal("/api/v2.0/campaigns?page_limit=10&api_key=noapikey"); | ||
} | ||
); | ||
}); | ||
return service.get('campaigns', conn, userParams).then((data) => { | ||
expect(data).to.have.property('meta') | ||
.and.have.property('count', userParams.page_limit); | ||
expect(conn.get.called).to.equal(true); | ||
expect(conn.get.getCall(0).args[0]).equal('/api/v2.0/campaigns?page_limit=10&api_key=noapikey'); | ||
}); | ||
}); | ||
}); | ||
describe("#get next page", function () { | ||
var userParams = {}; | ||
describe('#get next page', () => { | ||
const userParams = {}; | ||
it("should have request the correct next page of entities", function () { | ||
let parsedResult = common.loadFixture('campaigns-100'); | ||
it('should have request the correct next page of entities', () => { | ||
const parsedResult = common.loadFixture('campaigns-100'); | ||
let conn = new ConnectionStub(); | ||
const conn = new ConnectionStub(); | ||
sinon.stub(conn, 'get') | ||
.resolves(parsedResult); | ||
sinon.stub(conn, 'get') | ||
.resolves(parsedResult); | ||
return service.get('campaigns', conn, userParams).then(function (page1) { | ||
return service.getNextPage(page1, conn) | ||
}).then(function (page2) { | ||
expect(conn.get.callCount).to.equal(2) | ||
expect(conn.get.getCall(1).args[0]).equal("https://api.mediamath.com/api/v2.0/campaigns?page_offset=100&api_key=noapikey"); | ||
}); | ||
}); | ||
return service.get('campaigns', conn, userParams).then(page1 => service.getNextPage(page1, conn)).then(() => { | ||
expect(conn.get.callCount).to.equal(2); | ||
expect(conn.get.getCall(1).args[0]).equal('https://api.mediamath.com/api/v2.0/campaigns?page_offset=100&api_key=noapikey'); | ||
}); | ||
}); | ||
}); | ||
describe('#get list with child entities', () => { | ||
const userParams = { with: ['strategies'] }; | ||
it('it should include the child strategies', () => { | ||
const parsedResult = common.loadFixture('campaigns-with-strategies'); | ||
const conn = new ConnectionStub(); | ||
sinon.stub(conn, 'get') | ||
.resolves(parsedResult); | ||
return service.get('campaigns', conn, userParams).then((data) => { | ||
const campaign = data.entities.next().value; | ||
const strategy = campaign.strategies.entities.next().value; | ||
return expect(strategy.name).to.equal('Strategy 11'); | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -1,85 +0,81 @@ | ||
var BPromise = require('bluebird'); | ||
var expect = require('./chai_config').expect; | ||
var sinon = require('sinon'); | ||
var t1 = require('../index'); | ||
var common = require('./test-common'); | ||
'use strict'; // eslint-disable-line | ||
describe("strategy audience segments", function () { | ||
const BPromise = require('bluebird'); | ||
const expect = require('./chai_config').expect; | ||
const sinon = require('sinon'); | ||
const t1 = require('../index'); | ||
const common = require('./test-common'); | ||
var connectionStub = {}; | ||
connectionStub.get = function () { | ||
}; | ||
connectionStub.post = function () { | ||
}; | ||
connectionStub.buildQueryString = function () { | ||
return ""; | ||
}; | ||
var sandbox, getStub, postStub; | ||
var parsedResult = "aisdaiusd"; | ||
describe('strategy audience segments', () => { | ||
const connectionStub = {}; | ||
connectionStub.get = function get() { | ||
}; | ||
connectionStub.post = function get() { | ||
}; | ||
connectionStub.buildQueryString = function buildQueryString() { | ||
return ''; | ||
}; | ||
let sandbox; | ||
let parsedResult = 'aisdaiusd'; | ||
beforeEach(function () { | ||
sandbox = sinon.sandbox.create(); | ||
getStub = sandbox.stub(connectionStub, "get").returns(BPromise.try(function () { | ||
return parsedResult; | ||
})); | ||
postStub = sandbox.stub(connectionStub, "post").returns(BPromise.try(function () { | ||
return parsedResult; | ||
})); | ||
}); | ||
beforeEach(() => { | ||
sandbox = sinon.sandbox.create(); | ||
sandbox.stub(connectionStub, 'get').returns(BPromise.try(() => parsedResult)); | ||
sandbox.stub(connectionStub, 'post').returns(BPromise.try(() => parsedResult)); | ||
}); | ||
afterEach(function () { | ||
sandbox.restore(); | ||
}); | ||
afterEach(() => { | ||
sandbox.restore(); | ||
}); | ||
describe("#get strategy audience segments", function () { | ||
parsedResult = common.loadFixture('strategy-audience-segments'); | ||
describe('#get strategy audience segments', () => { | ||
parsedResult = common.loadFixture('strategy-audience-segments'); | ||
var audienceSegments = new t1.StrategyAudienceSegments(); | ||
let audienceSegments = new t1.StrategyAudienceSegments(); | ||
it("should have strategy audience segments", function () { | ||
audienceSegments = audienceSegments.get(1171990, connectionStub); | ||
it('should have strategy audience segments', () => { | ||
audienceSegments = audienceSegments.get(1171990, connectionStub); | ||
return expect(audienceSegments).to.eventually | ||
.have.property('strategy_id', 1171990) && | ||
return expect(audienceSegments).to.eventually | ||
.have.property('strategy_id', 1171990) && | ||
expect(audienceSegments).to.eventually | ||
.have.property('include') | ||
.and.deep.equal([1358322, 1460324]) && | ||
expect(audienceSegments).to.eventually | ||
.have.property('exclude') | ||
.and.deep.equal([1405158]) && | ||
expect(audienceSegments).to.eventually | ||
.have.property('exclude_op') | ||
.and.equal('OR') && | ||
expect(audienceSegments).to.eventually | ||
.have.property('include_op') | ||
.and.equal('AND'); | ||
}); | ||
expect(audienceSegments).to.eventually | ||
.have.property('include') | ||
.and.deep.equal([1358322, 1460324]) && | ||
expect(audienceSegments).to.eventually | ||
.have.property('exclude') | ||
.and.deep.equal([1405158]) && | ||
expect(audienceSegments).to.eventually | ||
.have.property('exclude_op') | ||
.and.equal('OR') && | ||
expect(audienceSegments).to.eventually | ||
.have.property('include_op') | ||
.and.equal('AND'); | ||
}); | ||
}); | ||
describe("#update audience", function () { | ||
parsedResult = common.loadFixture('strategy-audience-segments'); | ||
describe('#update audience', () => { | ||
parsedResult = common.loadFixture('strategy-audience-segments'); | ||
var audienceSegments = new t1.StrategyAudienceSegments(); | ||
audienceSegments.include = [1]; | ||
audienceSegments.exclude = [119]; | ||
audienceSegments.include_op = 'OR'; | ||
audienceSegments.exclude_op = 'OR'; | ||
const audienceSegments = new t1.StrategyAudienceSegments(); | ||
audienceSegments.include = [1]; | ||
audienceSegments.exclude = [119]; | ||
audienceSegments.include_op = 'OR'; | ||
audienceSegments.exclude_op = 'OR'; | ||
it("should generate the correct formdata for posting", function () { | ||
it('should generate the correct formdata for posting', () => { | ||
const expected = { | ||
include_op: 'OR', | ||
exclude_op: 'OR', | ||
'segments.1.id': 1, | ||
'segments.1.restriction': 'INCLUDE', | ||
'segments.2.id': 119, | ||
'segments.2.restriction': 'EXCLUDE', | ||
}; | ||
const formdata = audienceSegments.generateForm(); | ||
var expected = { | ||
'include_op': 'OR', | ||
'exclude_op': 'OR', | ||
'segments.1.id': 1, | ||
'segments.1.restriction': 'INCLUDE', | ||
'segments.2.id': 119, | ||
'segments.2.restriction': 'EXCLUDE' | ||
}; | ||
var formdata = audienceSegments._generateForm(); | ||
return expect(formdata).to.eventually.deep.equal(expected); | ||
}); | ||
return expect(formdata).to.eventually.deep.equal(expected); | ||
}); | ||
}); | ||
}); |
@@ -1,85 +0,81 @@ | ||
var BPromise = require('bluebird'); | ||
var expect = require('./chai_config').expect; | ||
var sinon = require('sinon'); | ||
var t1 = require('../index'); | ||
var common = require('./test-common'); | ||
'use strict'; // eslint-disable-line | ||
describe("strategy target segments", function () { | ||
const BPromise = require('bluebird'); | ||
const expect = require('./chai_config').expect; | ||
const sinon = require('sinon'); | ||
const t1 = require('../index'); | ||
const common = require('./test-common'); | ||
var connectionStub = {}; | ||
connectionStub.get = function () { | ||
}; | ||
connectionStub.post = function () { | ||
}; | ||
var sandbox, getStub, postStub; | ||
var parsedResult = "aisdaiusd"; | ||
describe('strategy target segments', () => { | ||
const connectionStub = {}; | ||
connectionStub.get = function get() { | ||
}; | ||
connectionStub.post = function post() { | ||
}; | ||
let sandbox; | ||
let parsedResult = 'aisdaiusd'; | ||
beforeEach(function () { | ||
sandbox = sinon.sandbox.create(); | ||
getStub = sandbox.stub(connectionStub, "get").returns(BPromise.try(function () { | ||
return parsedResult; | ||
})); | ||
postStub = sandbox.stub(connectionStub, "post").returns(BPromise.try(function () { | ||
return parsedResult; | ||
})); | ||
}); | ||
beforeEach(() => { | ||
sandbox = sinon.sandbox.create(); | ||
sandbox.stub(connectionStub, 'get').returns(BPromise.try(() => parsedResult)); | ||
sandbox.stub(connectionStub, 'post').returns(BPromise.try(() => parsedResult)); | ||
}); | ||
afterEach(function () { | ||
sandbox.restore(); | ||
}); | ||
afterEach(() => { | ||
sandbox.restore(); | ||
}); | ||
describe("#get strategy target segments", function () { | ||
parsedResult = common.loadFixture('strategy-targeting-segments'); | ||
describe('#get strategy target segments', () => { | ||
parsedResult = common.loadFixture('strategy-targeting-segments'); | ||
var targetingSegments = new t1.StrategyTargetSegments(); | ||
let targetingSegments = new t1.StrategyTargetSegments(); | ||
it("should have strategy targeting segments", function () { | ||
targetingSegments = targetingSegments.get(1171990, connectionStub); | ||
it('should have strategy targeting segments', () => { | ||
targetingSegments = targetingSegments.get(1171990, connectionStub); | ||
return expect(targetingSegments).to.eventually | ||
.have.property('strategy_id', 1171990) && | ||
return expect(targetingSegments).to.eventually | ||
.have.property('strategy_id', 1171990) && | ||
expect(targetingSegments).to.eventually | ||
.have.property('include') | ||
.and.deep.equal([[119, 'OR'], [118, 'OR']]) && | ||
expect(targetingSegments).to.eventually | ||
.have.property('exclude') | ||
.and.deep.equal([[1, 'OR']]) && | ||
expect(targetingSegments).to.eventually | ||
.have.property('exclude_op') | ||
.and.equal('OR') && | ||
expect(targetingSegments).to.eventually | ||
.have.property('include_op') | ||
.and.equal('OR'); | ||
}); | ||
expect(targetingSegments).to.eventually | ||
.have.property('include') | ||
.and.deep.equal([[119, 'OR'], [118, 'OR']]) && | ||
expect(targetingSegments).to.eventually | ||
.have.property('exclude') | ||
.and.deep.equal([[1, 'OR']]) && | ||
expect(targetingSegments).to.eventually | ||
.have.property('exclude_op') | ||
.and.equal('OR') && | ||
expect(targetingSegments).to.eventually | ||
.have.property('include_op') | ||
.and.equal('OR'); | ||
}); | ||
}); | ||
describe("#update targeting", function () { | ||
parsedResult = common.loadFixture('strategy-targeting-segments'); | ||
describe('#update targeting', () => { | ||
parsedResult = common.loadFixture('strategy-targeting-segments'); | ||
var targetingSegments = new t1.StrategyTargetSegments(); | ||
targetingSegments.include = [[1, 'OR']]; | ||
targetingSegments.exclude = [[119, 'OR']]; | ||
targetingSegments.include_op = 'OR'; | ||
targetingSegments.exclude_op = 'OR'; | ||
const targetingSegments = new t1.StrategyTargetSegments(); | ||
targetingSegments.include = [[1, 'OR']]; | ||
targetingSegments.exclude = [[119, 'OR']]; | ||
targetingSegments.include_op = 'OR'; | ||
targetingSegments.exclude_op = 'OR'; | ||
it("should generate the correct formdata for posting", function () { | ||
it('should generate the correct formdata for posting', () => { | ||
const expected = { | ||
include_op: 'OR', | ||
exclude_op: 'OR', | ||
'segments.1.id': 1, | ||
'segments.1.operator': 'OR', | ||
'segments.1.restriction': 'INCLUDE', | ||
'segments.2.id': 119, | ||
'segments.2.operator': 'OR', | ||
'segments.2.restriction': 'EXCLUDE', | ||
var expected = { | ||
'include_op': 'OR', | ||
'exclude_op': 'OR', | ||
'segments.1.id': 1, | ||
'segments.1.operator': 'OR', | ||
'segments.1.restriction': 'INCLUDE', | ||
'segments.2.id': 119, | ||
'segments.2.operator': 'OR', | ||
'segments.2.restriction': 'EXCLUDE' | ||
}; | ||
const formdata = targetingSegments.generateForm(); | ||
}; | ||
var formdata = targetingSegments._generateForm(); | ||
return expect(formdata).to.eventually.deep.equal(expected); | ||
}); | ||
return expect(formdata).to.eventually.deep.equal(expected); | ||
}); | ||
}); | ||
}); |
@@ -1,92 +0,88 @@ | ||
var BPromise = require('bluebird'); | ||
var expect = require('./chai_config').expect; | ||
var sinon = require('sinon'); | ||
var t1 = require('../index'); | ||
var common = require('./test-common'); | ||
'use strict'; // eslint-disable-line | ||
describe("strategy target values", function () { | ||
const BPromise = require('bluebird'); | ||
const expect = require('./chai_config').expect; | ||
const sinon = require('sinon'); | ||
const t1 = require('../index'); | ||
const common = require('./test-common'); | ||
var connectionStub = {}; | ||
connectionStub.get = function () { | ||
}; | ||
connectionStub.post = function () { | ||
}; | ||
var sandbox, getStub, postStub; | ||
var parsedResult = "aisdaiusd"; | ||
describe('strategy target values', () => { | ||
const connectionStub = {}; | ||
connectionStub.get = function get() { | ||
}; | ||
connectionStub.post = function get() { | ||
}; | ||
let sandbox; | ||
let parsedResult = 'aisdaiusd'; | ||
beforeEach(function () { | ||
sandbox = sinon.sandbox.create(); | ||
getStub = sandbox.stub(connectionStub, "get").returns(BPromise.try(function () { | ||
return parsedResult; | ||
})); | ||
postStub = sandbox.stub(connectionStub, "post").returns(BPromise.try(function () { | ||
return parsedResult; | ||
})); | ||
}); | ||
beforeEach(() => { | ||
sandbox = sinon.sandbox.create(); | ||
sandbox.stub(connectionStub, 'get').returns(BPromise.try(() => parsedResult)); | ||
sandbox.stub(connectionStub, 'post').returns(BPromise.try(() => parsedResult)); | ||
}); | ||
afterEach(function () { | ||
sandbox.restore(); | ||
}); | ||
afterEach(() => { | ||
sandbox.restore(); | ||
}); | ||
describe("#get strategy target values", function () { | ||
parsedResult = common.loadFixture('strategy-target-values'); | ||
var targetingSegments = new t1.StrategyTargetValues(); | ||
it("should have strategy target dimensions and values", function () { | ||
targetingSegments = targetingSegments.get(123456, connectionStub); | ||
describe('#get strategy target values', () => { | ||
parsedResult = common.loadFixture('strategy-target-values'); | ||
let targetingSegments = new t1.StrategyTargetValues(); | ||
it('should have strategy target dimensions and values', () => { | ||
targetingSegments = targetingSegments.get(123456, connectionStub); | ||
var expectedDimensions = [ | ||
{ | ||
code: "REGN", | ||
operation: "OR", | ||
restriction: "INCLUDE", | ||
value_ids: [251, 23] | ||
}, | ||
{ | ||
code: "REGN", | ||
operation: "OR", | ||
restriction: "EXCLUDE", | ||
value_ids: [31] | ||
}, | ||
{ | ||
code: "DMAX", | ||
operation: "OR", | ||
restriction: "INCLUDE", | ||
value_ids: [99846] | ||
}]; | ||
const expectedDimensions = [ | ||
{ | ||
code: 'REGN', | ||
operation: 'OR', | ||
restriction: 'INCLUDE', | ||
value_ids: [251, 23], | ||
}, | ||
{ | ||
code: 'REGN', | ||
operation: 'OR', | ||
restriction: 'EXCLUDE', | ||
value_ids: [31], | ||
}, | ||
{ | ||
code: 'DMAX', | ||
operation: 'OR', | ||
restriction: 'INCLUDE', | ||
value_ids: [99846], | ||
}]; | ||
return expect(targetingSegments).to.eventually | ||
.have.property('strategy_id', 123456) && | ||
expect(targetingSegments).to.eventually | ||
.have.property('dimensions') | ||
.and.deep.equal(expectedDimensions); | ||
}); | ||
return expect(targetingSegments).to.eventually | ||
.have.property('strategy_id', 123456) && | ||
expect(targetingSegments).to.eventually | ||
.have.property('dimensions') | ||
.and.deep.equal(expectedDimensions); | ||
}); | ||
}); | ||
describe("#update targeting", function () { | ||
var targetingDimensions = new t1.StrategyTargetValues(); | ||
targetingDimensions.addTargetValues('REGN', 'INCLUDE', 'OR', [23, 251]); | ||
targetingDimensions.addTargetValues('REGN', 'EXCLUDE', 'OR', [31]); | ||
targetingDimensions.addTargetValues('DMAX', 'INCLUDE', 'OR', [99846]); | ||
describe('#update targeting', () => { | ||
const targetingDimensions = new t1.StrategyTargetValues(); | ||
targetingDimensions.addTargetValues('REGN', 'INCLUDE', 'OR', [23, 251]); | ||
targetingDimensions.addTargetValues('REGN', 'EXCLUDE', 'OR', [31]); | ||
targetingDimensions.addTargetValues('DMAX', 'INCLUDE', 'OR', [99846]); | ||
it("should generate the correct formdata for posting", function () { | ||
it('should generate the correct formdata for posting', () => { | ||
const expected = { | ||
'dimensions.1.code': 'REGN', | ||
'dimensions.1.restriction': 'INCLUDE', | ||
'dimensions.1.operation': 'OR', | ||
'dimensions.1.value_ids': '23,251', | ||
'dimensions.2.code': 'REGN', | ||
'dimensions.2.restriction': 'EXCLUDE', | ||
'dimensions.2.operation': 'OR', | ||
'dimensions.2.value_ids': '31', | ||
'dimensions.3.code': 'DMAX', | ||
'dimensions.3.restriction': 'INCLUDE', | ||
'dimensions.3.operation': 'OR', | ||
'dimensions.3.value_ids': '99846', | ||
}; | ||
const formdata = targetingDimensions.generateForm(); | ||
var expected = { | ||
'dimensions.1.code': 'REGN', | ||
'dimensions.1.restriction': 'INCLUDE', | ||
'dimensions.1.operation': 'OR', | ||
'dimensions.1.value_ids': '23,251', | ||
'dimensions.2.code': 'REGN', | ||
'dimensions.2.restriction': 'EXCLUDE', | ||
'dimensions.2.operation': 'OR', | ||
'dimensions.2.value_ids': '31', | ||
'dimensions.3.code': 'DMAX', | ||
'dimensions.3.restriction': 'INCLUDE', | ||
'dimensions.3.operation': 'OR', | ||
'dimensions.3.value_ids': '99846' | ||
}; | ||
var formdata = targetingDimensions._generateForm(); | ||
return expect(formdata).to.eventually.deep.equal(expected); | ||
}); | ||
return expect(formdata).to.eventually.deep.equal(expected); | ||
}); | ||
}); | ||
}); |
@@ -1,6 +0,7 @@ | ||
var loadFixture = function (fixtureName) { | ||
var fs = require("fs"); | ||
return fs.readFileSync(__dirname + '/fixtures' + '/' + fixtureName + ".json", "utf8"); | ||
const fs = require('fs'); | ||
const loadFixture = function loadFixture(fixtureName) { | ||
return fs.readFileSync(`${__dirname}/fixtures/${fixtureName}.json`, 'utf8'); | ||
}; | ||
exports.loadFixture = loadFixture; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
985860
281.94%167
77.66%6567
10.17%230
11.65%22
-8.33%8
14.29%14
75%+ Added
+ Added
Updated
Updated
Updated