Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GumGum: Add product parameter #3253

Merged
merged 5 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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: 13 additions & 5 deletions adapters/gumgum/gumgum.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (
"github.com/prebid/prebid-server/v2/openrtb_ext"
)

// GumGumAdapter implements Bidder interface.
type GumGumAdapter struct {
// adapter implements Bidder interface.
type adapter struct {
URI string
}

// MakeRequests makes the HTTP requests which should be made to fetch bids.
func (g *GumGumAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
func (g *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
var validImps []openrtb2.Imp
var siteCopy openrtb2.Site
if request.Site != nil {
Expand Down Expand Up @@ -80,7 +80,7 @@ func (g *GumGumAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adap
}

// MakeBids unpacks the server's response into Bids.
func (g *GumGumAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
func (g *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) {
if response.StatusCode == http.StatusNoContent {
return nil, nil
}
Expand Down Expand Up @@ -176,6 +176,14 @@ func preprocess(imp *openrtb2.Imp) (*openrtb_ext.ExtImpGumGum, error) {
}
}

if gumgumExt.Product != "" {
var err error
imp.Ext, err = json.Marshal(map[string]string{"product": gumgumExt.Product})
if err != nil {
return nil, err
}
}

gg-natalia marked this conversation as resolved.
Show resolved Hide resolved
return &gumgumExt, nil
}

Expand Down Expand Up @@ -223,7 +231,7 @@ func validateVideoParams(video *openrtb2.Video) (err error) {

// Builder builds a new instance of the GumGum adapter for the given bidder with the given config.
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
bidder := &GumGumAdapter{
bidder := &adapter{
URI: config.Endpoint,
}
return bidder, nil
Expand Down
4 changes: 4 additions & 0 deletions adapters/gumgum/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ var validParams = []string{
`{"zone":"dc9d6be1"}`,
`{"pubId":12345678}`,
`{"zone":"dc9d6be1", "pubId":12345678}`,
`{"zone":"dc9d6be1", "pubId":12345678, "product": "skins"}`,
`{"zone":"dc9d6be1", "slot":1234567}`,
`{"pubId":12345678, "slot":1234567}`,
`{"pubId":12345678, "irisid": "iris_6f9285823a48bne5"}`,
`{"zone":"dc9d6be1", "irisid": "iris_6f9285823a48bne5"}`,
`{"zone":"dc9d6be1", "pubId":12345678, "irisid": "iris_6f9285823a48bne5"}`,
`{"zone":"dc9d6be1", "pubId":12345678, "irisid": "iris_6f9285823a48bne5", "product": "skins"}`,
}

var invalidParams = []string{
Expand All @@ -62,4 +64,6 @@ var invalidParams = []string{
`{"zone":"1234567", "irisid": ""}`,
`{"zone":"1234567", "irisid": 1234}`,
`{"irisid": "iris_6f9285823a48bne5"}`,
`{"product": "test"}`,
`{"product": 12345678}`,
}
9 changes: 5 additions & 4 deletions openrtb_ext/imp_gumgum.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package openrtb_ext
// ExtImpGumGum defines the contract for bidrequest.imp[i].ext.prebid.bidder.gumgum
// Either Zone or PubId must be present, others are optional parameters
type ExtImpGumGum struct {
Zone string `json:"zone,omitempty"`
PubID float64 `json:"pubId,omitempty"`
IrisID string `json:"irisid,omitempty"`
Slot float64 `json:"slot,omitempty"`
Zone string `json:"zone,omitempty"`
PubID float64 `json:"pubId,omitempty"`
IrisID string `json:"irisid,omitempty"`
Slot float64 `json:"slot,omitempty"`
Product string `json:"product,omitempty"`
}

// ExtImpGumGumVideo defines the contract for bidresponse.seatbid.bid[i].ext.prebid.bidder.gumgum.video
Expand Down
6 changes: 5 additions & 1 deletion static/bidder-params/gumgum.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"slot": {
"type": "integer",
"description": "A slot id used to identify a slot placement mapped to a GumGum zone or publisher"
},
"product": {
"type": "string",
"description": "Product param that allow support for Desktop Skins - display and video"
}
},
"anyOf": [
Expand All @@ -34,4 +38,4 @@
]
}
]
}
}
Loading