1
- package emx_digital
1
+ package cadent_aperture_mx
2
2
3
3
import (
4
4
"encoding/json"
@@ -17,7 +17,7 @@ import (
17
17
"github.com/prebid/prebid-server/openrtb_ext"
18
18
)
19
19
20
- type EmxDigitalAdapter struct {
20
+ type CadentApertureMXAdapter struct {
21
21
endpoint string
22
22
testing bool
23
23
}
@@ -33,7 +33,7 @@ func buildEndpoint(endpoint string, testing bool, timeout int64) string {
33
33
return endpoint + "?t=" + strconv .FormatInt (timeout , 10 ) + "&ts=" + strconv .FormatInt (time .Now ().Unix (), 10 ) + "&src=pbserver"
34
34
}
35
35
36
- func (a * EmxDigitalAdapter ) MakeRequests (request * openrtb2.BidRequest , reqInfo * adapters.ExtraRequestInfo ) ([]* adapters.RequestData , []error ) {
36
+ func (a * CadentApertureMXAdapter ) MakeRequests (request * openrtb2.BidRequest , reqInfo * adapters.ExtraRequestInfo ) ([]* adapters.RequestData , []error ) {
37
37
var errs []error
38
38
39
39
if len (request .Imp ) == 0 {
@@ -81,35 +81,35 @@ func (a *EmxDigitalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *
81
81
}}, errs
82
82
}
83
83
84
- func unpackImpExt (imp * openrtb2.Imp ) (* openrtb_ext.ExtImpEmxDigital , error ) {
84
+ func unpackImpExt (imp * openrtb2.Imp ) (* openrtb_ext.ExtImpCadentApertureMX , error ) {
85
85
var bidderExt adapters.ExtImpBidder
86
86
if err := json .Unmarshal (imp .Ext , & bidderExt ); err != nil {
87
87
return nil , & errortypes.BadInput {
88
88
Message : err .Error (),
89
89
}
90
90
}
91
91
92
- var emxExt openrtb_ext.ExtImpEmxDigital
93
- if err := json .Unmarshal (bidderExt .Bidder , & emxExt ); err != nil {
92
+ var cadentExt openrtb_ext.ExtImpCadentApertureMX
93
+ if err := json .Unmarshal (bidderExt .Bidder , & cadentExt ); err != nil {
94
94
return nil , & errortypes.BadInput {
95
95
Message : fmt .Sprintf ("ignoring imp id=%s, invalid ImpExt" , imp .ID ),
96
96
}
97
97
}
98
98
99
- tagIDValidation , err := strconv .ParseInt (emxExt .TagID , 10 , 64 )
99
+ tagIDValidation , err := strconv .ParseInt (cadentExt .TagID , 10 , 64 )
100
100
if err != nil || tagIDValidation == 0 {
101
101
return nil , & errortypes.BadInput {
102
102
Message : fmt .Sprintf ("ignoring imp id=%s, invalid tagid must be a String of numbers" , imp .ID ),
103
103
}
104
104
}
105
105
106
- if emxExt .TagID == "" {
106
+ if cadentExt .TagID == "" {
107
107
return nil , & errortypes.BadInput {
108
108
Message : fmt .Sprintf ("Ignoring imp id=%s, no tagid present" , imp .ID ),
109
109
}
110
110
}
111
111
112
- return & emxExt , nil
112
+ return & cadentExt , nil
113
113
}
114
114
115
115
func buildImpBanner (imp * openrtb2.Imp ) error {
@@ -175,13 +175,13 @@ func cleanProtocol(protocols []adcom1.MediaCreativeSubtype) []adcom1.MediaCreati
175
175
return newitems
176
176
}
177
177
178
- // Add EMX required properties to Imp object
179
- func addImpProps (imp * openrtb2.Imp , secure * int8 , emxExt * openrtb_ext.ExtImpEmxDigital ) {
180
- imp .TagID = emxExt .TagID
178
+ // Add Cadent required properties to Imp object
179
+ func addImpProps (imp * openrtb2.Imp , secure * int8 , cadentExt * openrtb_ext.ExtImpCadentApertureMX ) {
180
+ imp .TagID = cadentExt .TagID
181
181
imp .Secure = secure
182
182
183
- if emxExt .BidFloor != "" {
184
- bidFloor , err := strconv .ParseFloat (emxExt .BidFloor , 64 )
183
+ if cadentExt .BidFloor != "" {
184
+ bidFloor , err := strconv .ParseFloat (cadentExt .BidFloor , 64 )
185
185
if err != nil {
186
186
bidFloor = 0
187
187
}
@@ -202,7 +202,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str
202
202
}
203
203
}
204
204
205
- // Handle request errors and formatting to be sent to EMX
205
+ // Handle request errors and formatting to be sent to Cadent
206
206
func preprocess (request * openrtb2.BidRequest ) []error {
207
207
impsCount := len (request .Imp )
208
208
errors := make ([]error , 0 , impsCount )
@@ -225,13 +225,13 @@ func preprocess(request *openrtb2.BidRequest) []error {
225
225
}
226
226
227
227
for _ , imp := range request .Imp {
228
- emxExt , err := unpackImpExt (& imp )
228
+ cadentExt , err := unpackImpExt (& imp )
229
229
if err != nil {
230
230
errors = append (errors , err )
231
231
continue
232
232
}
233
233
234
- addImpProps (& imp , & secure , emxExt )
234
+ addImpProps (& imp , & secure , cadentExt )
235
235
236
236
if imp .Video != nil {
237
237
if err := buildImpVideo (& imp ); err != nil {
@@ -253,7 +253,7 @@ func preprocess(request *openrtb2.BidRequest) []error {
253
253
}
254
254
255
255
// MakeBids make the bids for the bid response.
256
- func (a * EmxDigitalAdapter ) MakeBids (internalRequest * openrtb2.BidRequest , externalRequest * adapters.RequestData , response * adapters.ResponseData ) (* adapters.BidderResponse , []error ) {
256
+ func (a * CadentApertureMXAdapter ) MakeBids (internalRequest * openrtb2.BidRequest , externalRequest * adapters.RequestData , response * adapters.ResponseData ) (* adapters.BidderResponse , []error ) {
257
257
258
258
if response .StatusCode == http .StatusNoContent {
259
259
// no bid response
@@ -309,9 +309,9 @@ func ContainsAny(raw string, keys []string) bool {
309
309
310
310
}
311
311
312
- // Builder builds a new instance of the EmxDigital adapter for the given bidder with the given config.
312
+ // Builder builds a new instance of the Cadent Aperture MX adapter for the given bidder with the given config.
313
313
func Builder (bidderName openrtb_ext.BidderName , config config.Adapter , server config.Server ) (adapters.Bidder , error ) {
314
- bidder := & EmxDigitalAdapter {
314
+ bidder := & CadentApertureMXAdapter {
315
315
endpoint : config .Endpoint ,
316
316
testing : false ,
317
317
}
0 commit comments