Skip to content
Closed
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
16 changes: 8 additions & 8 deletions adapters/imds/imds.go → adapters/advertising/advertising.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package imds
package advertising

import (
"encoding/json"
Expand Down Expand Up @@ -31,7 +31,7 @@ type ReqExt struct {
SeatId string `json:"seatId"`
}

// Builder builds a new instance of the Imds adapter for the given bidder with the given config.
// Builder builds a new instance of the Advertising.com adapter for the given bidder with the given config.
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
template, err := template.New("endpointTemplate").Parse(config.Endpoint)
if err != nil {
Expand Down Expand Up @@ -61,7 +61,7 @@ func (a *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestDa
var errs []error
var validImps []openrtb2.Imp
var re *ReqExt
var firstExtImp *openrtb_ext.ExtImpImds = nil
var firstExtImp *openrtb_ext.ExtImpAdvertising = nil

for _, imp := range request.Imp {
validExtImpObj, err := getExtImpObj(&imp) // getExtImpObj returns {seatId:"", tagId:""}
Expand Down Expand Up @@ -131,26 +131,26 @@ func (a *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestDa
}

// Builds enpoint url based on adapter-specific pub settings from imp.ext
func (adapter *adapter) buildEndpointURL(params *openrtb_ext.ExtImpImds) (string, error) {
func (adapter *adapter) buildEndpointURL(params *openrtb_ext.ExtImpAdvertising) (string, error) {
return macros.ResolveMacros(adapter.EndpointTemplate, macros.EndpointTemplateParams{AccountID: url.QueryEscape(params.SeatId), SourceId: url.QueryEscape(adapterVersion)})
}

func getExtImpObj(imp *openrtb2.Imp) (*openrtb_ext.ExtImpImds, error) {
func getExtImpObj(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdvertising, error) {
var bidderExt adapters.ExtImpBidder
if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil {
return nil, &errortypes.BadInput{
Message: err.Error(),
}
}

var imdsExt openrtb_ext.ExtImpImds
if err := jsonutil.Unmarshal(bidderExt.Bidder, &imdsExt); err != nil {
var advertisingExt openrtb_ext.ExtImpAdvertising
if err := jsonutil.Unmarshal(bidderExt.Bidder, &advertisingExt); err != nil {
return nil, &errortypes.BadInput{
Message: err.Error(),
}
}

return &imdsExt, nil
return &advertisingExt, nil
}

// MakeBids make the bids for the bid response.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package imds
package advertising

import (
"testing"
Expand All @@ -10,18 +10,18 @@ import (
)

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderImds, config.Adapter{
Endpoint: "http://pbs.technoratimedia.com/openrtb/bids/{{.AccountID}}?src={{.SourceId}}&adapter=imds"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
bidder, buildErr := Builder(openrtb_ext.BidderAdvertising, config.Adapter{
Endpoint: "http://pbs.technoratimedia.com/openrtb/bids/{{.AccountID}}?src={{.SourceId}}&adapter=advertising"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})

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

adapterstest.RunJSONBidderTest(t, "imdstest", bidder)
adapterstest.RunJSONBidderTest(t, "advertisingtest", bidder)
}

func TestEndpointTemplateMalformed(t *testing.T) {
_, buildErr := Builder(openrtb_ext.BidderImds, config.Adapter{
_, buildErr := Builder(openrtb_ext.BidderAdvertising, config.Adapter{
Endpoint: "{{Malformed}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})

assert.Error(t, buildErr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "test-request-id",
"ext": {
Expand Down Expand Up @@ -74,12 +74,12 @@
}
}
],
"seat": "imds"
"seat": "advertising"
}
],
"ext": {
"responsetimemillis": {
"imds": 339
"advertising": 339
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "1",
"site": {
Expand Down Expand Up @@ -88,12 +88,12 @@
}
}
],
"seat": "imds"
"seat": "advertising"
}
],
"ext": {
"responsetimemillis": {
"imds": 339
"advertising": 339
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

"expectedMakeRequestsErrors": [
{
"value": "cannot unmarshal openrtb_ext.ExtImpImds.SeatId: expects \" or n, but found 1",
"value": "cannot unmarshal openrtb_ext.ExtImpAdvertising.SeatId: expects \" or n, but found 1",
"comparison": "literal"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "test-request-id",
"ext": {
Expand Down Expand Up @@ -91,12 +91,12 @@
}
}
],
"seat": "imds"
"seat": "advertising"
}
],
"ext": {
"responsetimemillis": {
"imds": 339
"advertising": 339
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=advertising",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package imds
package advertising

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

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

// TestValidParams makes sure that the imds schema accepts all imp.ext fields which we intend to support.
// TestValidParams makes sure that the advertising.com 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.BidderImds, json.RawMessage(validParam)); err != nil {
t.Errorf("Schema rejected imds params: %s", validParam)
if err := validator.Validate(openrtb_ext.BidderAdvertising, json.RawMessage(validParam)); err != nil {
t.Errorf("Schema rejected advertising.com params: %s", validParam)
}
}
}

// TestInvalidParams makes sure that the imds schema rejects all the imp.ext fields we don't support.
// TestInvalidParams makes sure that the advertising.com 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.BidderImds, json.RawMessage(invalidParam)); err == nil {
if err := validator.Validate(openrtb_ext.BidderAdvertising, json.RawMessage(invalidParam)); err == nil {
t.Errorf("Schema allowed unexpected params: %s", invalidParam)
}
}
Expand Down
4 changes: 2 additions & 2 deletions exchange/adapter_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/prebid/prebid-server/v3/adapters/adtrgtme"
"github.com/prebid/prebid-server/v3/adapters/aduptech"
"github.com/prebid/prebid-server/v3/adapters/advangelists"
"github.com/prebid/prebid-server/v3/adapters/advertising"
"github.com/prebid/prebid-server/v3/adapters/adverxo"
"github.com/prebid/prebid-server/v3/adapters/adview"
"github.com/prebid/prebid-server/v3/adapters/adxcg"
Expand Down Expand Up @@ -110,7 +111,6 @@ import (
"github.com/prebid/prebid-server/v3/adapters/grid"
"github.com/prebid/prebid-server/v3/adapters/gumgum"
"github.com/prebid/prebid-server/v3/adapters/huaweiads"
"github.com/prebid/prebid-server/v3/adapters/imds"
"github.com/prebid/prebid-server/v3/adapters/impactify"
"github.com/prebid/prebid-server/v3/adapters/improvedigital"
"github.com/prebid/prebid-server/v3/adapters/infytv"
Expand Down Expand Up @@ -358,7 +358,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderGrid: grid.Builder,
openrtb_ext.BidderGumGum: gumgum.Builder,
openrtb_ext.BidderHuaweiAds: huaweiads.Builder,
openrtb_ext.BidderImds: imds.Builder,
openrtb_ext.BidderAdvertising: advertising.Builder,
openrtb_ext.BidderImpactify: impactify.Builder,
openrtb_ext.BidderImprovedigital: improvedigital.Builder,
openrtb_ext.BidderInfyTV: infytv.Builder,
Expand Down
4 changes: 2 additions & 2 deletions openrtb_ext/bidders.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var coreBidderNames []BidderName = []BidderName{
BidderGrid,
BidderGumGum,
BidderHuaweiAds,
BidderImds,
BidderAdvertising,
BidderImpactify,
BidderImprovedigital,
BidderInfyTV,
Expand Down Expand Up @@ -481,7 +481,7 @@ const (
BidderGrid BidderName = "grid"
BidderGumGum BidderName = "gumgum"
BidderHuaweiAds BidderName = "huaweiads"
BidderImds BidderName = "imds"
BidderAdvertising BidderName = "advertising"
BidderImpactify BidderName = "impactify"
BidderImprovedigital BidderName = "improvedigital"
BidderInfyTV BidderName = "infytv"
Expand Down
7 changes: 7 additions & 0 deletions openrtb_ext/imp_advertising.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package openrtb_ext

// ExtImpAdvertising defines the contract for bidrequest.imp[i].ext.prebid.bidder.advertising
type ExtImpAdvertising struct {
SeatId string `json:"seatId"`
TagId string `json:"tagId"`
}
7 changes: 0 additions & 7 deletions openrtb_ext/imp_imds.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ geoscope:
- USA
- CAN
maintainer:
email: "eng-demand@imds.tv"
email: "prebid@advertising.com"
capabilities:
app:
mediaTypes:
Expand Down
3 changes: 0 additions & 3 deletions static/bidder-info/synacormedia.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "iMedia Digital Services (IMDS) Adapter Params",
"description": "A schema which validates params accepted by the iMedia Digital Services (IMDS) adapter",
"title": "Advertising.com Adapter Params",
"description": "A schema which validates params accepted by the Advertising.com adapter",

"type": "object",
"properties": {
Expand Down
Loading