Skip to content

Commit

Permalink
Updating to use deepAccess util method (prebid#4105).
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallari committed Aug 27, 2019
1 parent a1c1392 commit b4889be
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/optimeraBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { registerBidder } from '../src/adapters/bidderFactory';
import { deepAccess } from '../src/utils';

const BIDDER_CODE = 'optimera';
const SCORES_BASE_URL = 'https://dyv1bugovvq1g.cloudfront.net/';
Expand Down Expand Up @@ -58,9 +59,10 @@ export const spec = {
for (let i = 0; i < validBids.length; i += 1) {
if (typeof validBids[i].params.clientID !== 'undefined') {
if (validBids[i].adUnitCode in scores) {
const deviceCode = deepAccess(validBids[i], 'params.device');
dealId = scores[validBids[i].adUnitCode];
if (typeof validBids[i].params.device == 'string' && typeof scores.device == 'object' && typeof scores.device[validBids[i].params.device] == 'object' && typeof scores.device[validBids[i].params.device][validBids[i].adUnitCode] != 'undefined') {
dealId = scores.device[validBids[i].params.device][validBids[i].adUnitCode];
if (deepAccess(scores, `device.${deviceCode}.${validBids[i].adUnitCode}`)) {
dealId = scores.device[deviceCode][validBids[i].adUnitCode];
}
}
const bidResponse = {
Expand Down

0 comments on commit b4889be

Please sign in to comment.