Skip to content

Commit

Permalink
Revert "Rubicon: Add imp[].ext.rp.rtb.formats logic (#3255)"
Browse files Browse the repository at this point in the history
This reverts commit 8e9f3f3.
  • Loading branch information
Sonali-More-Xandr authored Oct 30, 2023
1 parent 8e9f3f3 commit 42bde78
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 550 deletions.
30 changes: 3 additions & 27 deletions adapters/rubicon/rubicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ type rubiconImpExtRP struct {
ZoneID int `json:"zone_id"`
Target json.RawMessage `json:"target,omitempty"`
Track rubiconImpExtRPTrack `json:"track"`
RTB *rubiconImpExtRpRtb `json:"rtb,omitempty"`
}

type rubiconImpExtRpRtb struct {
Formats []openrtb_ext.BidType `json:"formats,omitempty"`
}

type rubiconUserExtRP struct {
Expand Down Expand Up @@ -304,10 +299,6 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ada
Skadn: bidderExt.Skadn,
}

if len(bidderExt.Bidder.Formats) > 0 {
impExt.RP.RTB = &rubiconImpExtRpRtb{bidderExt.Bidder.Formats}
}

imp.Ext, err = json.Marshal(&impExt)
if err != nil {
errs = append(errs, err)
Expand Down Expand Up @@ -601,31 +592,19 @@ func prepareImpsToExtMap(impsToExtMap map[*openrtb2.Imp]rubiconExtImpBidder) map
continue
}

splitImps, formats := splitMultiFormatImp(imp)
splitImps := splitMultiFormatImp(imp)
for _, imp := range splitImps {
impCopy := imp

existingFormats := bidderExt.Bidder.Formats
var resolvedFormats []openrtb_ext.BidType
if len(existingFormats) > 0 {
resolvedFormats = existingFormats
} else {
resolvedFormats = formats
}
bidderExt.Bidder.Formats = resolvedFormats

preparedImpsToExtMap[impCopy] = bidderExt
}
}

return preparedImpsToExtMap
}

func splitMultiFormatImp(imp *openrtb2.Imp) ([]*openrtb2.Imp, []openrtb_ext.BidType) {
func splitMultiFormatImp(imp *openrtb2.Imp) []*openrtb2.Imp {
splitImps := make([]*openrtb2.Imp, 0)
mediaTypes := make([]openrtb_ext.BidType, 0)
if imp.Banner != nil {
mediaTypes = append(mediaTypes, openrtb_ext.BidTypeBanner)
impCopy := *imp
impCopy.Video = nil
impCopy.Native = nil
Expand All @@ -634,7 +613,6 @@ func splitMultiFormatImp(imp *openrtb2.Imp) ([]*openrtb2.Imp, []openrtb_ext.BidT
}

if imp.Video != nil {
mediaTypes = append(mediaTypes, openrtb_ext.BidTypeVideo)
impCopy := *imp
impCopy.Banner = nil
impCopy.Native = nil
Expand All @@ -643,7 +621,6 @@ func splitMultiFormatImp(imp *openrtb2.Imp) ([]*openrtb2.Imp, []openrtb_ext.BidT
}

if imp.Native != nil {
mediaTypes = append(mediaTypes, openrtb_ext.BidTypeNative)
impCopy := *imp
impCopy.Banner = nil
impCopy.Video = nil
Expand All @@ -652,15 +629,14 @@ func splitMultiFormatImp(imp *openrtb2.Imp) ([]*openrtb2.Imp, []openrtb_ext.BidT
}

if imp.Audio != nil {
mediaTypes = append(mediaTypes, openrtb_ext.BidTypeAudio)
impCopy := *imp
impCopy.Banner = nil
impCopy.Video = nil
impCopy.Native = nil
splitImps = append(splitImps, &impCopy)
}

return splitImps, mediaTypes
return splitImps
}

func resolveBidFloor(bidFloor float64, bidFloorCur string, reqInfo *adapters.ExtraRequestInfo) (float64, error) {
Expand Down
Loading

0 comments on commit 42bde78

Please sign in to comment.