From 2d088c2da0a77a83a376066bd1a9efcef7703f1d Mon Sep 17 00:00:00 2001 From: Natalia Castiglioni Date: Tue, 24 Oct 2023 10:48:32 -0300 Subject: [PATCH 1/5] Add product support for gg --- adapters/gumgum/gumgum.go | 4 ++++ adapters/gumgum/params_test.go | 1 + openrtb_ext/imp_gumgum.go | 9 +++++---- static/bidder-params/gumgum.json | 6 +++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index 3b954bf5837..2ce6800f946 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -176,6 +176,10 @@ func preprocess(imp *openrtb2.Imp) (*openrtb_ext.ExtImpGumGum, error) { } } + if gumgumExt.Product != "" { + imp.Ext = json.RawMessage(fmt.Sprintf(`{ "product": "%s" }`, gumgumExt.Product)) + } + return &gumgumExt, nil } diff --git a/adapters/gumgum/params_test.go b/adapters/gumgum/params_test.go index afee017be03..98534d5f334 100644 --- a/adapters/gumgum/params_test.go +++ b/adapters/gumgum/params_test.go @@ -42,6 +42,7 @@ var validParams = []string{ `{"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{ diff --git a/openrtb_ext/imp_gumgum.go b/openrtb_ext/imp_gumgum.go index 96a1308d663..f54234fa394 100644 --- a/openrtb_ext/imp_gumgum.go +++ b/openrtb_ext/imp_gumgum.go @@ -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 diff --git a/static/bidder-params/gumgum.json b/static/bidder-params/gumgum.json index 95f05e7d517..c9972713f87 100644 --- a/static/bidder-params/gumgum.json +++ b/static/bidder-params/gumgum.json @@ -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": [ @@ -34,4 +38,4 @@ ] } ] -} +} \ No newline at end of file From aacc87998298598604d962efd6d54558d0ac7384 Mon Sep 17 00:00:00 2001 From: Natalia Castiglioni Date: Wed, 25 Oct 2023 09:37:16 -0300 Subject: [PATCH 2/5] Pr feedback for not using raw message --- adapters/gumgum/gumgum.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index 2ce6800f946..428d252fc8b 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -177,7 +177,12 @@ func preprocess(imp *openrtb2.Imp) (*openrtb_ext.ExtImpGumGum, error) { } if gumgumExt.Product != "" { - imp.Ext = json.RawMessage(fmt.Sprintf(`{ "product": "%s" }`, gumgumExt.Product)) + var err error + //imp.Ext, err = json.Marshal(`{ "product": "%s" }`, gumgumExt.Product) + imp.Ext, err = json.Marshal(map[string]string{"product": gumgumExt.Product}) + if err != nil { + return nil, err + } } return &gumgumExt, nil From 71d44ba92b8f8713d5327b4fdf1e6bf114b7c9d1 Mon Sep 17 00:00:00 2001 From: Natalia Castiglioni Date: Fri, 27 Oct 2023 08:45:12 -0300 Subject: [PATCH 3/5] ADTS-396 pr feedback --- adapters/gumgum/gumgum.go | 1 - adapters/gumgum/params_test.go | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index 428d252fc8b..3b17a3a78a9 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -178,7 +178,6 @@ func preprocess(imp *openrtb2.Imp) (*openrtb_ext.ExtImpGumGum, error) { if gumgumExt.Product != "" { var err error - //imp.Ext, err = json.Marshal(`{ "product": "%s" }`, gumgumExt.Product) imp.Ext, err = json.Marshal(map[string]string{"product": gumgumExt.Product}) if err != nil { return nil, err diff --git a/adapters/gumgum/params_test.go b/adapters/gumgum/params_test.go index 98534d5f334..11874cdbd61 100644 --- a/adapters/gumgum/params_test.go +++ b/adapters/gumgum/params_test.go @@ -37,6 +37,7 @@ 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"}`, @@ -63,4 +64,6 @@ var invalidParams = []string{ `{"zone":"1234567", "irisid": ""}`, `{"zone":"1234567", "irisid": 1234}`, `{"irisid": "iris_6f9285823a48bne5"}`, + `{"product": "test"}`, + `{"product": 12345678}`, } From f030cb6ed5de9d2ee66ee6910924f7272c565ed9 Mon Sep 17 00:00:00 2001 From: Natalia Castiglioni Date: Fri, 27 Oct 2023 16:30:46 -0300 Subject: [PATCH 4/5] ADTS-396 pr feedback --- adapters/gumgum/gumgum.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index 3b17a3a78a9..ea9624c73c7 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -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 { @@ -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 } @@ -231,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 From cb64523e1cf67d0c94eaf72ff75f3c041ae277dd Mon Sep 17 00:00:00 2001 From: Natalia Castiglioni Date: Thu, 2 Nov 2023 17:25:48 -0300 Subject: [PATCH 5/5] ADTS-396 add sample file for tests --- .../banner-with-pubId-product-params.json | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 adapters/gumgum/gumgumtest/supplemental/banner-with-pubId-product-params.json diff --git a/adapters/gumgum/gumgumtest/supplemental/banner-with-pubId-product-params.json b/adapters/gumgum/gumgumtest/supplemental/banner-with-pubId-product-params.json new file mode 100644 index 00000000000..6e2793658d3 --- /dev/null +++ b/adapters/gumgum/gumgumtest/supplemental/banner-with-pubId-product-params.json @@ -0,0 +1,104 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 300 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "pubId": 12345678 + }, + "product": "skins" + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://g2.gumgum.com/providers/prbds2s/bid", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 300 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "pubId": 12345678 + }, + "product": "skins" + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "seatbid": [ + { + "bid": [ + { + "crid": "2068416", + "adm": "some-test-ad", + "adid": "2068416", + "price": 5, + "id": "5736a50b-6b05-42a8-aa6d-b0a4649dcd05", + "impid": "test-imp-id", + "cid": "4747" + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "crid": "2068416", + "adm": "some-test-ad", + "adid": "2068416", + "price": 5, + "id": "5736a50b-6b05-42a8-aa6d-b0a4649dcd05", + "impid": "test-imp-id", + "cid": "4747" + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file