Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion adapters/cwire/cwire.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,28 @@ func (a *adapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.Request
bidderResponse.Currency = resp.Cur
for _, sb := range resp.SeatBid {
for i := range sb.Bid {
bidType, err := getBidType(sb.Bid[i])
if err != nil {
return nil, []error{err}
}
bidderResponse.Bids = append(bidderResponse.Bids, &adapters.TypedBid{
Bid: &sb.Bid[i],
BidType: openrtb_ext.BidTypeBanner,
BidType: bidType,
})
}
}

return bidderResponse, nil
}

func getBidType(bid openrtb2.Bid) (openrtb_ext.BidType, error) {
// determinate media type by bid response field mtype
switch bid.MType {
case openrtb2.MarkupBanner:
return openrtb_ext.BidTypeBanner, nil
case openrtb2.MarkupVideo:
return openrtb_ext.BidTypeVideo, nil
}

return "", fmt.Errorf("could not define media type for C Wire impression: %s", bid.ImpID)
}
152 changes: 152 additions & 0 deletions adapters/cwire/cwiretest/exemplary/video.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"mockBidRequest": {
"id": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"cur": [
"CHF"
],
"imp": [
{
"id": "103",
"video": {
"mimes": [
"video/mp4"
],
"protocols": [
2,
5
],
"w": 640,
"h": 480
},
"ext": {
"bidder": {
"placementId": 15,
"domainId": 42
}
}
}
],
"site": {
"page": "http://www.foobar.com/1234.html"
},
"device": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0"
},
"user": {
"id": "55816b39711f9b5acf3b90e313ed29e51665623f",
"geo": {
"country": "ch",
"region": "basel-stadt",
"city": "basel"
}
}
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://cwi.re/prebid/adapter-endpoint",
"headers": {
"Content-Type": [
"application/json;charset=utf-8"
],
"Accept": [
"application/json"
]
},
"body": {
"id": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"cur": [
"CHF"
],
"imp": [
{
"id": "103",
"video": {
"mimes": [
"video/mp4"
],
"protocols": [
2,
5
],
"w": 640,
"h": 480
},
"ext": {
"bidder": {
"placementId": 15,
"domainId": 42
}
}
}
],
"site": {
"page": "http://www.foobar.com/1234.html"
},
"device": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0"
},
"user": {
"id": "55816b39711f9b5acf3b90e313ed29e51665623f",
"geo": {
"country": "ch",
"region": "basel-stadt",
"city": "basel"
}
}
},
"impIDs": [
"103"
]
},
"mockResponse": {
"status": 200,
"headers": {},
"body": {
"id": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"cur": "CHF",
"seatbid": [
{
"seat": "cwire",
"group": 0,
"bid": [
{
"id": "334",
"impid": "103",
"price": 8.00,
"crid": "9999",
"adm": "<VAST version=\"3.0\"></VAST>",
"w": 640,
"h": 480,
"nurl": "https://embed.cwi.re/delivery/prebid-server/win/334",
"mtype": 2
}
]
}
]
}
}
}
],
"expectedBidResponses": [
{
"currency": "CHF",
"bids": [
{
"bid": {
"id": "334",
"impid": "103",
"price": 8.00,
"crid": "9999",
"adm": "<VAST version=\"3.0\"></VAST>",
"w": 640,
"h": 480,
"nurl": "https://embed.cwi.re/delivery/prebid-server/win/334",
"mtype": 2
},
"type": "video"
}
]
}
]
}
4 changes: 4 additions & 0 deletions static/bidder-info/cwire.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ capabilities:
app:
mediaTypes:
- banner
- video
site:
mediaTypes:
- banner
- video
openrtb:
multiformat-supported: false
userSync:
iframe:
url: https://prebid.cwi.re/v1/usersync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&rd={{.RedirectURL}}
Expand Down
Loading