Skip to content

Commit

Permalink
create site.ext.data when it doesn't exist (#11902)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehb-mtk authored Jul 2, 2024
1 parent 4e470c5 commit 5caa7fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 16 additions & 2 deletions modules/mobianRtdProvider.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
/**
* This module adds the Mobian RTD provider to the real time data module
* The {@link module:modules/realTimeData} module is required
* @module modules/anonymisedRtdProvider
* @requires module:modules/realTimeData
*/
import { submodule } from '../src/hook.js';
import { ajaxBuilder } from '../src/ajax.js';
import { deepSetValue } from '../src/utils.js';

/**
* @typedef {import('../modules/rtdModule/index.js').RtdSubmodule} RtdSubmodule
*/

export const MOBIAN_URL = 'https://impact-api-prod.themobian.com/brand_safety';

/** @type {RtdSubmodule} */
export const mobianBrandSafetySubmodule = {
name: 'mobianBrandSafety',
gvlid: null,
init: init,
getBidRequestData: getBidRequestData
};
Expand Down Expand Up @@ -36,10 +48,12 @@ function getBidRequestData(bidReqConfig, callback, config) {
'mobianGarmRisk': mobianGarmRisk
};
resolve(risk);
ortb2Site.ext.data['mobian'] = risk
deepSetValue(ortb2Site.ext, 'data.mobian', risk);
callback()
},
error: function () {
resolve({});
callback()
}
});
});
Expand Down
4 changes: 1 addition & 3 deletions test/spec/modules/mobianRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ describe('Mobian RTD Submodule', function () {
ortb2Fragments: {
global: {
site: {
ext: {
data: {}
}
ext: {}
}
}
}
Expand Down

0 comments on commit 5caa7fc

Please sign in to comment.