forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathehealthcaresolutionsBidAdapter.js
41 lines (39 loc) · 1.21 KB
/
ehealthcaresolutionsBidAdapter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import {
BANNER,
NATIVE
} from '../src/mediaTypes.js';
import {
registerBidder
} from '../src/adapters/bidderFactory.js';
import {
getBannerRequest,
getBannerResponse,
getNativeResponse,
} from '../libraries/audUtils/bidderUtils.js';
const ENDPOINT_URL = 'https://rtb.ehealthcaresolutions.com/hb';
// Export const spec
export const spec = {
code: 'ehealthcaresolutions',
supportedMediaTypes: [BANNER, NATIVE],
// Determines whether or not the given bid request is valid
isBidRequestValid: (bParam) => {
return !!(bParam.params.placement_id);
},
// Make a server request from the list of BidRequests
buildRequests: (bidRequests, serverRequest) => {
// Get Requests based on media types
return getBannerRequest(bidRequests, serverRequest, ENDPOINT_URL);
},
// Unpack the response from the server into a list of bids.
interpretResponse: (bResponse, bRequest) => {
let Response = {};
const mediaType = JSON.parse(bRequest.data)[0].MediaType;
if (mediaType == BANNER) {
Response = getBannerResponse(bResponse, BANNER);
} else if (mediaType == NATIVE) {
Response = getNativeResponse(bResponse, bRequest, NATIVE);
}
return Response;
}
}
registerBidder(spec);