Skip to content

Commit

Permalink
AndBeyond.Media adapter: rename bidder (#2408)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndBeyondMediaHB authored Oct 18, 2022
1 parent 21b2bd6 commit 32f88e3
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package andbeyondmedia
package beyondmedia

import (
"encoding/json"
Expand All @@ -17,7 +17,7 @@ type adapter struct {
}

type reqBodyExt struct {
AndBeyondMediaBidderExt reqBodyExtBidder `json:"bidder"`
BeyondMediaBidderExt reqBodyExtBidder `json:"bidder"`
}

type reqBodyExtBidder struct {
Expand All @@ -41,18 +41,18 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E
reqCopy.Imp = []openrtb2.Imp{imp}

var bidderExt adapters.ExtImpBidder
var andBeyondMediaExt openrtb_ext.ImpExtAndBeyondMedia
var beyondMediaExt openrtb_ext.ImpExtBeyondMedia

if err = json.Unmarshal(reqCopy.Imp[0].Ext, &bidderExt); err != nil {
return nil, []error{err}
}
if err = json.Unmarshal(bidderExt.Bidder, &andBeyondMediaExt); err != nil {
if err = json.Unmarshal(bidderExt.Bidder, &beyondMediaExt); err != nil {
return nil, []error{err}
}

temp := reqBodyExt{AndBeyondMediaBidderExt: reqBodyExtBidder{}}
temp.AndBeyondMediaBidderExt.PlacementID = andBeyondMediaExt.PlacementID
temp.AndBeyondMediaBidderExt.Type = "publisher"
temp := reqBodyExt{BeyondMediaBidderExt: reqBodyExtBidder{}}
temp.BeyondMediaBidderExt.PlacementID = beyondMediaExt.PlacementID
temp.BeyondMediaBidderExt.Type = "publisher"

finalyImpExt, err := json.Marshal(temp)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package andbeyondmedia
package beyondmedia

import (
"testing"
Expand All @@ -9,12 +9,12 @@ import (
)

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderAndBeyondMedia, config.Adapter{
bidder, buildErr := Builder(openrtb_ext.BidderBeyondMedia, config.Adapter{
Endpoint: "http://backend.andbeyond.media/pserver"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})

if buildErr != nil {
t.Fatalf("Builder returned unexpected error %v", buildErr)
}

adapterstest.RunJSONBidderTest(t, "andbeyondmediatest", bidder)
adapterstest.RunJSONBidderTest(t, "beyondmediatest", bidder)
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
}
}
],
"seat": "andbeyondmedia"
"seat": "beyondmedia"
}
],
"cur": "USD"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
}
}
],
"seat": "andbeyondmedia"
"seat": "beyondmedia"
}
],
"cur": "USD"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
}
}
],
"seat": "andbeyondmedia"
"seat": "beyondmedia"
}
],
"cur": "USD"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
}
}
],
"seat": "andbeyondmedia"
"seat": "beyondmedia"
}
],
"cur": "USD"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
}
}
],
"seat": "andbeyondmedia"
"seat": "beyondmedia"
}
],
"cur": "USD"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package andbeyondmedia
package beyondmedia

import (
"encoding/json"
Expand All @@ -14,7 +14,7 @@ func TestValidParams(t *testing.T) {
}

for _, p := range validParams {
if err := validator.Validate(openrtb_ext.BidderAndBeyondMedia, json.RawMessage(p)); err != nil {
if err := validator.Validate(openrtb_ext.BidderBeyondMedia, json.RawMessage(p)); err != nil {
t.Errorf("Schema rejected valid params: %s", p)
}
}
Expand All @@ -27,7 +27,7 @@ func TestInvalidParams(t *testing.T) {
}

for _, p := range invalidParams {
if err := validator.Validate(openrtb_ext.BidderAndBeyondMedia, json.RawMessage(p)); err == nil {
if err := validator.Validate(openrtb_ext.BidderBeyondMedia, json.RawMessage(p)); err == nil {
t.Errorf("Schema allowed invalid params: %s", p)
}
}
Expand Down
4 changes: 2 additions & 2 deletions exchange/adapter_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/prebid/prebid-server/adapters/aja"
"github.com/prebid/prebid-server/adapters/algorix"
"github.com/prebid/prebid-server/adapters/amx"
"github.com/prebid/prebid-server/adapters/andbeyondmedia"
"github.com/prebid/prebid-server/adapters/apacdex"
"github.com/prebid/prebid-server/adapters/applogy"
"github.com/prebid/prebid-server/adapters/appnexus"
Expand All @@ -41,6 +40,7 @@ import (
"github.com/prebid/prebid-server/adapters/beachfront"
"github.com/prebid/prebid-server/adapters/beintoo"
"github.com/prebid/prebid-server/adapters/between"
"github.com/prebid/prebid-server/adapters/beyondmedia"
"github.com/prebid/prebid-server/adapters/bidmachine"
"github.com/prebid/prebid-server/adapters/bidmyadz"
"github.com/prebid/prebid-server/adapters/bidscube"
Expand Down Expand Up @@ -185,7 +185,6 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderAJA: aja.Builder,
openrtb_ext.BidderAlgorix: algorix.Builder,
openrtb_ext.BidderAMX: amx.Builder,
openrtb_ext.BidderAndBeyondMedia: andbeyondmedia.Builder,
openrtb_ext.BidderApacdex: apacdex.Builder,
openrtb_ext.BidderApplogy: applogy.Builder,
openrtb_ext.BidderAppnexus: appnexus.Builder,
Expand All @@ -196,6 +195,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderBeachfront: beachfront.Builder,
openrtb_ext.BidderBeintoo: beintoo.Builder,
openrtb_ext.BidderBetween: between.Builder,
openrtb_ext.BidderBeyondMedia: beyondmedia.Builder,
openrtb_ext.BidderBidmachine: bidmachine.Builder,
openrtb_ext.BidderBidmyadz: bidmyadz.Builder,
openrtb_ext.BidderBidsCube: bidscube.Builder,
Expand Down
9 changes: 5 additions & 4 deletions exchange/adapter_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ func GetActiveBidders(infos config.BidderInfos) map[string]openrtb_ext.BidderNam
// GetDisabledBiddersErrorMessages returns a map of error messages for disabled bidders.
func GetDisabledBiddersErrorMessages(infos config.BidderInfos) map[string]string {
disabledBidders := map[string]string{
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
}

for name, info := range infos {
Expand Down
40 changes: 22 additions & 18 deletions exchange/adapter_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,42 +207,46 @@ func TestGetDisabledBiddersErrorMessages(t *testing.T) {
description: "None",
bidderInfos: map[string]config.BidderInfo{},
expected: map[string]string{
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
},
},
{
description: "Enabled",
bidderInfos: map[string]config.BidderInfo{"appnexus": infoEnabled},
expected: map[string]string{
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
},
},
{
description: "Disabled",
bidderInfos: map[string]config.BidderInfo{"appnexus": infoDisabled},
expected: map[string]string{
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"appnexus": `Bidder "appnexus" has been disabled on this instance of Prebid Server. Please work with the PBS host to enable this bidder again.`,
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"appnexus": `Bidder "appnexus" has been disabled on this instance of Prebid Server. Please work with the PBS host to enable this bidder again.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
},
},
{
description: "Mixed",
bidderInfos: map[string]config.BidderInfo{"appnexus": infoDisabled, "openx": infoEnabled},
expected: map[string]string{
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"appnexus": `Bidder "appnexus" has been disabled on this instance of Prebid Server. Please work with the PBS host to enable this bidder again.`,
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahoossp" in your configuration.`,
"appnexus": `Bidder "appnexus" has been disabled on this instance of Prebid Server. Please work with the PBS host to enable this bidder again.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions openrtb_ext/bidders.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ const (
BidderAJA BidderName = "aja"
BidderAlgorix BidderName = "algorix"
BidderAMX BidderName = "amx"
BidderAndBeyondMedia BidderName = "andbeyondmedia"
BidderApacdex BidderName = "apacdex"
BidderApplogy BidderName = "applogy"
BidderAppnexus BidderName = "appnexus"
Expand All @@ -121,6 +120,7 @@ const (
BidderBeachfront BidderName = "beachfront"
BidderBeintoo BidderName = "beintoo"
BidderBetween BidderName = "between"
BidderBeyondMedia BidderName = "beyondmedia"
BidderBidmachine BidderName = "bidmachine"
BidderBidmyadz BidderName = "bidmyadz"
BidderBidsCube BidderName = "bidscube"
Expand Down Expand Up @@ -273,7 +273,6 @@ func CoreBidderNames() []BidderName {
BidderAJA,
BidderAlgorix,
BidderAMX,
BidderAndBeyondMedia,
BidderApacdex,
BidderApplogy,
BidderAppnexus,
Expand All @@ -284,6 +283,7 @@ func CoreBidderNames() []BidderName {
BidderBeachfront,
BidderBeintoo,
BidderBetween,
BidderBeyondMedia,
BidderBidmachine,
BidderBidmyadz,
BidderBidsCube,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package openrtb_ext

type ImpExtAndBeyondMedia struct {
type ImpExtBeyondMedia struct {
PlacementID string `json:"placementId"`
}
File renamed without changes.
File renamed without changes.

0 comments on commit 32f88e3

Please sign in to comment.