Skip to content

Commit

Permalink
updated server url and removed host variable requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
jmayor committed Jul 17, 2023
1 parent 156e8a2 commit a6d353d
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 39 deletions.
12 changes: 3 additions & 9 deletions adapters/datablocks/datablocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (a *DatablocksAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *
"Accept": {"application/json"},
}

// Pull the host and source ID info from the bidder params.
// Pull the source ID info from the bidder params.
reqImps, err := splitImpressions(request.Imp)

if err != nil {
Expand All @@ -45,7 +45,7 @@ func (a *DatablocksAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *
continue
}

urlParams := macros.EndpointTemplateParams{Host: reqExt.Host, SourceId: strconv.Itoa(reqExt.SourceId)}
urlParams := macros.EndpointTemplateParams{SourceId: strconv.Itoa(reqExt.SourceId)}
url, err := macros.ResolveMacros(a.EndpointTemplate, urlParams)

if err != nil {
Expand Down Expand Up @@ -137,7 +137,7 @@ func getBidderParams(imp *openrtb2.Imp) (*openrtb_ext.ExtImpDatablocks, error) {
var datablocksExt openrtb_ext.ExtImpDatablocks
if err := json.Unmarshal(bidderExt.Bidder, &datablocksExt); err != nil {
return nil, &errortypes.BadInput{
Message: fmt.Sprintf("Cannot Resolve host or sourceId: %s", err.Error()),
Message: fmt.Sprintf("Cannot Resolve sourceId: %s", err.Error()),
}
}

Expand All @@ -147,12 +147,6 @@ func getBidderParams(imp *openrtb2.Imp) (*openrtb_ext.ExtImpDatablocks, error) {
}
}

if len(datablocksExt.Host) < 1 {
return nil, &errortypes.BadInput{
Message: "Invalid/Missing Host",
}
}

return &datablocksExt, nil
}

Expand Down
10 changes: 5 additions & 5 deletions adapters/datablocks/datablockstest/exemplary/multi-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand All @@ -34,7 +34,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand All @@ -54,7 +54,7 @@
{
"expectedRequest":
{
"uri": "http://search.nutella.datablocks.net/openrtb2?sid=906295",
"uri": "http://pbserver.dblks.net/openrtb2?sid=906295",
"body":
{
"id": "some-request-id",
Expand All @@ -73,7 +73,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand All @@ -91,7 +91,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand Down
6 changes: 3 additions & 3 deletions adapters/datablocks/datablockstest/exemplary/native.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand All @@ -38,7 +38,7 @@
{
"expectedRequest":
{
"uri": "http://search.nutella.datablocks.net/openrtb2?sid=906295",
"uri": "http://pbserver.dblks.net/openrtb2?sid=906295",
"body":
{
"id": "some-request-id",
Expand All @@ -54,7 +54,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand All @@ -41,7 +41,7 @@
{
"expectedRequest":
{
"uri": "http://search.nutella.datablocks.net/openrtb2?sid=906295",
"uri": "http://pbserver.dblks.net/openrtb2?sid=906295",
"body":
{
"id": "some-request-id",
Expand All @@ -64,7 +64,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand All @@ -39,7 +39,7 @@
{
"expectedRequest":
{
"uri": "http://search.nutella.datablocks.net/openrtb2?sid=906295",
"uri": "http://pbserver.dblks.net/openrtb2?sid=906295",
"body":
{
"id": "some-request-id",
Expand All @@ -59,7 +59,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 906295
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 123
}
}
Expand All @@ -37,7 +37,7 @@
{
"expectedRequest":
{
"uri": "http://search.nutella.datablocks.net/openrtb2?sid=123",
"uri": "http://pbserver.dblks.net/openrtb2?sid=123",
"body":
{
"id": "some-request-id",
Expand All @@ -56,7 +56,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 123
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 123
}
}
Expand All @@ -37,7 +37,7 @@
{
"expectedRequest":
{
"uri": "http://search.nutella.datablocks.net/openrtb2?sid=123",
"uri": "http://pbserver.dblks.net/openrtb2?sid=123",
"body":
{
"id": "some-request-id",
Expand All @@ -56,7 +56,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 123
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 0
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 123
}
}
Expand All @@ -37,7 +37,7 @@
{
"expectedRequest":
{
"uri": "http://search.nutella.datablocks.net/openrtb2?sid=123",
"uri": "http://pbserver.dblks.net/openrtb2?sid=123",
"body":
{
"id": "some-request-id",
Expand All @@ -56,7 +56,7 @@
{
"bidder":
{
"host": "search.nutella.datablocks.net",
"host": "pbserver.dblks.net",
"sourceId": 123
}
}
Expand Down
1 change: 0 additions & 1 deletion openrtb_ext/imp_datablocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ package openrtb_ext
// ExtImpDatablocks defines the contract for bidrequest.imp[i].ext.prebid.bidder.datablocks
type ExtImpDatablocks struct {
SourceId int `json:"sourceId"`
Host string `json:"host"`
}
6 changes: 1 addition & 5 deletions static/bidder-params/datablocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
"type": "integer",
"minimum": 1,
"description": "Website Source Id"
},
"host": {
"type": "string",
"description": "Network Host to request from"
}
},
"required": ["host", "sourceId"]
"required": ["sourceId"]
}

0 comments on commit a6d353d

Please sign in to comment.