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

New Adapter: yahoossp (Rebrand yssp to yahoossp keeping the yssp alias) #1994

Merged
merged 2 commits into from
Sep 23, 2021
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yssp
package yahoossp

import (
"encoding/json"
Expand All @@ -7,33 +7,33 @@ import (
"github.com/prebid/prebid-server/openrtb_ext"
)

// This file actually intends to test static/bidder-params/yssp.json
// This file actually intends to test static/bidder-params/yahoossp.json
//
// These also validate the format of the external API: request.imp[i].ext.yssp
// These also validate the format of the external API: request.imp[i].ext.yahoossp

// TestValidParams makes sure that the yssp schema accepts all imp.ext fields which we intend to support.
// TestValidParams makes sure that the yahoossp schema accepts all imp.ext fields which we intend to support.
func TestValidParams(t *testing.T) {
validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params")
if err != nil {
t.Fatalf("Failed to fetch the json-schemas. %v", err)
}

for _, validParam := range validParams {
if err := validator.Validate(openrtb_ext.BidderYSSP, json.RawMessage(validParam)); err != nil {
t.Errorf("Schema rejected yssp params: %s", validParam)
if err := validator.Validate(openrtb_ext.BidderYahooSSP, json.RawMessage(validParam)); err != nil {
t.Errorf("Schema rejected yahoossp params: %s", validParam)
}
}
}

// TestInvalidParams makes sure that the yssp schema rejects all the imp.ext fields we don't support.
// TestInvalidParams makes sure that the yahoossp schema rejects all the imp.ext fields we don't support.
func TestInvalidParams(t *testing.T) {
validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params")
if err != nil {
t.Fatalf("Failed to fetch the json-schemas. %v", err)
}

for _, invalidParam := range invalidParams {
if err := validator.Validate(openrtb_ext.BidderYSSP, json.RawMessage(invalidParam)); err == nil {
if err := validator.Validate(openrtb_ext.BidderYahooSSP, json.RawMessage(invalidParam)); err == nil {
t.Errorf("Schema allowed unexpected params: %s", invalidParam)
}
}
Expand Down
12 changes: 6 additions & 6 deletions adapters/yssp/yssp.go → adapters/yahoossp/yahoossp.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yssp
package yahoossp

import (
"encoding/json"
Expand Down Expand Up @@ -41,8 +41,8 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E
continue
}

var ysspExt openrtb_ext.ExtImpYSSP
err = json.Unmarshal(bidderExt.Bidder, &ysspExt)
var yahoosspExt openrtb_ext.ExtImpYahooSSP
err = json.Unmarshal(bidderExt.Bidder, &yahoosspExt)
if err != nil {
err = &errortypes.BadInput{
Message: fmt.Sprintf("imp #%d: %s", idx, err.Error()),
Expand All @@ -64,7 +64,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E
reqCopy.App = &appCopy
}

if err := changeRequestForBidService(&reqCopy, &ysspExt); err != nil {
if err := changeRequestForBidService(&reqCopy, &yahoosspExt); err != nil {
errors = append(errors, err)
continue
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func getImpInfo(impId string, imps []openrtb2.Imp) (bool, openrtb_ext.BidType) {
return exists, mediaType
}

func changeRequestForBidService(request *openrtb2.BidRequest, extension *openrtb_ext.ExtImpYSSP) error {
func changeRequestForBidService(request *openrtb2.BidRequest, extension *openrtb_ext.ExtImpYahooSSP) error {
/* Always override the tag ID and (site ID or app ID) of the request */
request.Imp[0].TagID = extension.Pos
if request.Site != nil {
Expand Down Expand Up @@ -180,7 +180,7 @@ func changeRequestForBidService(request *openrtb2.BidRequest, extension *openrtb
return nil
}

// Builder builds a new instance of the YSSP adapter for the given bidder with the given config.
// Builder builds a new instance of the YahooSSP adapter for the given bidder with the given config.
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) {
bidder := &adapter{
URI: config.Endpoint,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yssp
package yahoossp

import (
"testing"
Expand All @@ -9,26 +9,26 @@ import (
"github.com/prebid/prebid-server/openrtb_ext"
)

func TestYSSPBidderEndpointConfig(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderYSSP, config.Adapter{
func TestYahooSSPBidderEndpointConfig(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderYahooSSP, config.Adapter{
Endpoint: "http://localhost/bid",
})

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

bidderYSSP := bidder.(*adapter)
bidderYahooSSP := bidder.(*adapter)

assert.Equal(t, "http://localhost/bid", bidderYSSP.URI)
assert.Equal(t, "http://localhost/bid", bidderYahooSSP.URI)
}

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderYSSP, config.Adapter{})
bidder, buildErr := Builder(openrtb_ext.BidderYahooSSP, config.Adapter{})

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

adapterstest.RunJSONBidderTest(t, "yssptest", bidder)
adapterstest.RunJSONBidderTest(t, "yahoossptest", bidder)
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yssp",
"seat": "yahoossp",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yssp",
"seat": "yahoossp",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yssp",
"seat": "yahoossp",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yssp",
"seat": "yahoossp",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "wrong",
Expand Down
4 changes: 0 additions & 4 deletions adapters/yssp/yssptest/params/race/banner.json

This file was deleted.

1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@ func SetupViper(v *viper.Viper, filename string) {
v.SetDefault("adapters.viewdeos.endpoint", "http://ghb.sync.viewdeos.com/pbs/ortb")
v.SetDefault("adapters.visx.endpoint", "https://t.visx.net/s2s_bid?wrapperType=s2s_prebid_standard:0.1.0")
v.SetDefault("adapters.vrtcal.endpoint", "http://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804")
v.SetDefault("adapters.yahoossp.disabled", true)
guscarreon marked this conversation as resolved.
Show resolved Hide resolved
v.SetDefault("adapters.yeahmobi.endpoint", "https://{{.Host}}/prebid/bid")
v.SetDefault("adapters.yieldlab.endpoint", "https://ad.yieldlab.net/yp/")
v.SetDefault("adapters.yieldmo.endpoint", "https://ads.yieldmo.com/exchange/prebid-server")
Expand Down
7 changes: 4 additions & 3 deletions exchange/adapter_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ import (
"github.com/prebid/prebid-server/adapters/valueimpression"
"github.com/prebid/prebid-server/adapters/visx"
"github.com/prebid/prebid-server/adapters/vrtcal"
"github.com/prebid/prebid-server/adapters/yahoossp"
"github.com/prebid/prebid-server/adapters/yeahmobi"
"github.com/prebid/prebid-server/adapters/yieldlab"
"github.com/prebid/prebid-server/adapters/yieldmo"
"github.com/prebid/prebid-server/adapters/yieldone"
"github.com/prebid/prebid-server/adapters/yssp"
"github.com/prebid/prebid-server/adapters/zeroclickfraud"
"github.com/prebid/prebid-server/openrtb_ext"
)
Expand Down Expand Up @@ -252,15 +252,16 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderUnicorn: unicorn.Builder,
openrtb_ext.BidderUnruly: unruly.Builder,
openrtb_ext.BidderValueImpression: valueimpression.Builder,
openrtb_ext.BidderVerizonMedia: yssp.Builder,
openrtb_ext.BidderVerizonMedia: yahoossp.Builder,
openrtb_ext.BidderViewdeos: adtelligent.Builder,
openrtb_ext.BidderVisx: visx.Builder,
openrtb_ext.BidderVrtcal: vrtcal.Builder,
openrtb_ext.BidderYahooSSP: yahoossp.Builder,
openrtb_ext.BidderYeahmobi: yeahmobi.Builder,
openrtb_ext.BidderYieldlab: yieldlab.Builder,
openrtb_ext.BidderYieldmo: yieldmo.Builder,
openrtb_ext.BidderYieldone: yieldone.Builder,
openrtb_ext.BidderYSSP: yssp.Builder,
openrtb_ext.BidderYSSP: yahoossp.Builder,
guscarreon marked this conversation as resolved.
Show resolved Hide resolved
openrtb_ext.BidderZeroClickFraud: zeroclickfraud.Builder,
}
}
2 changes: 2 additions & 0 deletions openrtb_ext/bidders.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ const (
BidderVisx BidderName = "visx"
BidderViewdeos BidderName = "viewdeos"
BidderVrtcal BidderName = "vrtcal"
BidderYahooSSP BidderName = "yahoossp"
guscarreon marked this conversation as resolved.
Show resolved Hide resolved
BidderYeahmobi BidderName = "yeahmobi"
BidderYieldlab BidderName = "yieldlab"
BidderYieldmo BidderName = "yieldmo"
Expand Down Expand Up @@ -328,6 +329,7 @@ func CoreBidderNames() []BidderName {
BidderViewdeos,
BidderVisx,
BidderVrtcal,
BidderYahooSSP,
guscarreon marked this conversation as resolved.
Show resolved Hide resolved
BidderYeahmobi,
BidderYieldlab,
BidderYieldmo,
Expand Down
7 changes: 7 additions & 0 deletions openrtb_ext/imp_yahoossp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package openrtb_ext

// ExtImpYahooSSP defines the contract for bidrequest.imp[i].ext.yahoossp
type ExtImpYahooSSP struct {
Dcn string `json:"dcn"`
Pos string `json:"pos"`
}
7 changes: 0 additions & 7 deletions openrtb_ext/imp_yssp.go

This file was deleted.

15 changes: 15 additions & 0 deletions static/bidder-info/yahoossp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
maintainer:
email: "hb-fe-tech@oath.com"
gvlVendorID: 25
capabilities:
app:
mediaTypes:
- banner
site:
mediaTypes:
- banner
userSync:
# yahoossp supports user syncing, but requires configuration by the host. contact this
# bidder directly at the email address in this file to ask about enabling user sync.
supports:
- redirect
19 changes: 19 additions & 0 deletions static/bidder-params/yahoossp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "YahooSSP Adapter Params",
"description": "A schema which validates params accepted by the YahooSSP adapter",
"type": "object",
"properties": {
"dcn": {
"type": "string",
"minLength": 1,
"description": "Site ID provided by One Mobile"
},
"pos": {
"type": "string",
"minLength": 1,
"description": "Placement ID"
}
},
"required": ["dcn", "pos"]
}