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

Rubicon adapter: accept accountId, siteId, zoneId as strings #2110

Merged
merged 5 commits into from
Jan 10, 2022
Merged
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
26 changes: 22 additions & 4 deletions adapters/rubicon/rubicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,21 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ada
continue
}

siteId, err := rubiconExt.SiteId.Int64()
if err != nil {
errs = append(errs, err)
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for my own understanding, but is there a chance that the error we can get back is bad enough that we wouldn't want to continue execution?

I see this style of error handling in a lot of places in this file, so I was just wondering.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases we would like to continue execution.

}

zoneId, err := rubiconExt.ZoneId.Int64()
if err != nil {
errs = append(errs, err)
continue
}

impExt := rubiconImpExt{
RP: rubiconImpExtRP{
ZoneID: rubiconExt.ZoneId,
ZoneID: int(zoneId),
Target: target,
Track: rubiconImpExtRPTrack{Mint: "", MintVersion: ""},
},
Expand Down Expand Up @@ -534,11 +546,17 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ada
imp.Video = nil
}

pubExt := rubiconPubExt{RP: rubiconPubExtRP{AccountID: rubiconExt.AccountId}}
accountId, err := rubiconExt.AccountId.Int64()
if err != nil {
errs = append(errs, err)
continue
}

pubExt := rubiconPubExt{RP: rubiconPubExtRP{AccountID: int(accountId)}}

if request.Site != nil {
siteCopy := *request.Site
siteExtRP := rubiconSiteExt{RP: rubiconSiteExtRP{SiteID: rubiconExt.SiteId}}
siteExtRP := rubiconSiteExt{RP: rubiconSiteExtRP{SiteID: int(siteId)}}
if siteCopy.Content != nil {
siteTarget := make(map[string]interface{})
updateExtWithIabAttribute(siteTarget, siteCopy.Content.Data, []int{1, 2, 5, 6})
Expand All @@ -563,7 +581,7 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ada
rubiconRequest.Site = &siteCopy
} else {
appCopy := *request.App
appCopy.Ext, err = json.Marshal(rubiconSiteExt{RP: rubiconSiteExtRP{SiteID: rubiconExt.SiteId}})
appCopy.Ext, err = json.Marshal(rubiconSiteExt{RP: rubiconSiteExtRP{SiteID: int(siteId)}})
appCopy.Publisher = &openrtb2.Publisher{}
appCopy.Publisher.Ext, err = json.Marshal(&pubExt)
rubiconRequest.App = &appCopy
Expand Down
5 changes: 4 additions & 1 deletion adapters/rubicon/rubicon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,10 @@ func TestOpenRTBRequestWithVideoImpAndEnabledRewardedInventoryFlag(t *testing.T)
"is_rewarded_inventory": 1
},
"bidder": {
"video": {"size_id": 1}
"video": {"size_id": 1},
"zoneId": "123",
"siteId": 1234,
"accountId": "444"
}}`),
}},
App: &openrtb2.App{
Expand Down
Loading