Skip to content

Commit

Permalink
OpenX adapter: pass optional platform (PBID-598)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurb9 committed Jul 29, 2020
1 parent f1582a4 commit a798516
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
4 changes: 3 additions & 1 deletion adapters/openx/openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ type openxImpExt struct {
}

type openxReqExt struct {
DelDomain string `json:"delDomain"`
DelDomain string `json:"delDomain,omitempty"`
Platform string `json:"platform,omitempty"`
BidderConfig string `json:"bc"`
}

Expand Down Expand Up @@ -125,6 +126,7 @@ func preprocess(imp *openrtb.Imp, reqExt *openxReqExt) error {
}

reqExt.DelDomain = openxExt.DelDomain
reqExt.Platform = openxExt.Platform

imp.TagID = openxExt.Unit
imp.BidFloor = openxExt.CustomFloor
Expand Down
4 changes: 3 additions & 1 deletion adapters/openx/openxtest/exemplary/optional-params.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"bidder": {
"unit": "539439964",
"delDomain": "se-demo-d.openx.net",
"platform": "PLATFORM",
"customFloor": 0.1,
"customParams": {"foo": "bar"}
}
Expand Down Expand Up @@ -40,7 +41,8 @@
],
"ext": {
"bc": "hb_pbs_1.0.0",
"delDomain": "se-demo-d.openx.net"
"delDomain": "se-demo-d.openx.net",
"platform": "PLATFORM"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions openrtb_ext/imp_openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package openrtb_ext
// ExtImpOpenx defines the contract for bidrequest.imp[i].ext.openx
type ExtImpOpenx struct {
Unit string `json:"unit"`
Platform string `json:"platform"`
DelDomain string `json:"delDomain"`
CustomFloor float64 `json:"customFloor"`
CustomParams map[string]interface{} `json:"customParams"`
Expand Down
22 changes: 20 additions & 2 deletions static/bidder-params/openx.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"pattern": "\\.[a-zA-Z]{2,3}$",
"format": "hostname"
},
"platform": {
"type": "string",
"description": "The platform id for the customer.",
"format": "uuid"
},
"customFloor": {
"type": "number",
"description": "The minimum CPM price in USD.",
Expand All @@ -26,6 +31,19 @@
"description": "User-defined targeting key-value pairs."
}
},

"required": ["unit", "delDomain"]
"required": [
"unit"
],
"anyOf": [
{
"required": [
"delDomain"
]
},
{
"required": [
"platform"
]
}
]
}

0 comments on commit a798516

Please sign in to comment.