Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
494f8c1
Update Adoppler/ElementaTv:
pavel-ptashyts Dec 18, 2025
fb8f6b1
Update Adoppler/ElementaTv:
pavel-ptashyts Dec 18, 2025
3cf30b8
Update Adoppler/ElementaTv:
pavel-ptashyts Dec 18, 2025
b59b75d
Update Adoppler/ElementaTv
pavel-ptashyts Dec 18, 2025
5998af2
Merge branch 'master' into adoppler_to_elemental_rename_and_refactor
pavel-ptashyts Jan 12, 2026
4f18562
Merge branch 'master' into adoppler_to_elemental_rename_and_refactor
pavel-ptashyts Jan 15, 2026
9ae372e
Update Adoppler/ElementaTv add params_test.go
pavel-ptashyts Jan 19, 2026
8089b80
Update Adoppler/ElementaTv
pavel-ptashyts Jan 19, 2026
e309265
Update Adoppler/ElementaTv
pavel-ptashyts Jan 19, 2026
4e5037a
Update ElementalTv
pavel-ptashyts Jan 20, 2026
26a6fec
Merge branch 'master' into adoppler_to_elemental_rename_and_refactor
pavel-ptashyts Jan 26, 2026
720ecfb
Update adapters/elementaltv/elementaltv.go
pavel-ptashyts Jan 30, 2026
23928f5
Update adapters/elementaltv/elementaltv.go
pavel-ptashyts Jan 30, 2026
2774221
Update adapters/elementaltv/params_test.go
pavel-ptashyts Jan 30, 2026
a0f30a9
Update ElementalTv
pavel-ptashyts Jan 30, 2026
e0c0fcd
Merge branch 'master' into adoppler_to_elemental_rename_and_refactor
pavel-ptashyts Jan 30, 2026
7280fab
Update ElementalTv
pavel-ptashyts Jan 30, 2026
76a2fed
Update adapters/elementaltv/elementaltv_test.go
pavel-ptashyts Feb 2, 2026
8dc67cd
Code refactoring
pavel-ptashyts Feb 2, 2026
e561748
Merge branch 'master' into adoppler_to_elemental_rename_and_refactor
pavel-ptashyts Feb 2, 2026
3df45ba
Code refactoring
pavel-ptashyts Feb 2, 2026
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
20 changes: 0 additions & 20 deletions adapters/adoppler/adoppler_test.go

This file was deleted.

81 changes: 0 additions & 81 deletions adapters/adoppler/adopplertest/exemplary/custom-client.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package adoppler
package elementaltv

import (
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
Expand All @@ -17,12 +16,10 @@ import (
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

const DefaultClient = "app"

var bidHeaders http.Header = map[string][]string{
"Accept": {"application/json"},
"Content-Type": {"application/json;charset=utf-8"},
"X-OpenRTB-Version": {"2.5"},
"X-OpenRTB-Version": {"2.6"},
}

type adsVideoExt struct {
Expand All @@ -33,24 +30,24 @@ type adsImpExt struct {
Video *adsVideoExt `json:"video"`
}

type AdopplerAdapter struct {
type adapter struct {
endpoint *template.Template
}

// Builder builds a new instance of the Adoppler adapter for the given bidder with the given config.
// Builder builds a new instance of the ElementalTV 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 {
return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
return nil, fmt.Errorf("unable to parse endpoint url template: %w", err)
}

bidder := &AdopplerAdapter{
bidder := &adapter{
endpoint: template,
}
return bidder, nil
}

func (ads *AdopplerAdapter) MakeRequests(
func (ads *adapter) MakeRequests(
req *openrtb2.BidRequest,
info *adapters.ExtraRequestInfo,
) (
Expand All @@ -74,7 +71,7 @@ func (ads *AdopplerAdapter) MakeRequests(
r.ID = req.ID + "-" + ext.AdUnit
r.Imp = []openrtb2.Imp{imp}

body, err := json.Marshal(r)
body, err := jsonutil.Marshal(r)
if err != nil {
errs = append(errs, err)
continue
Expand All @@ -100,7 +97,7 @@ func (ads *AdopplerAdapter) MakeRequests(
return datas, errs
}

func (ads *AdopplerAdapter) MakeBids(
func (ads *adapter) MakeBids(
intReq *openrtb2.BidRequest,
extReq *adapters.RequestData,
resp *adapters.ResponseData,
Expand Down Expand Up @@ -193,33 +190,29 @@ func (ads *AdopplerAdapter) MakeBids(
return adsResp, nil
}

func (ads *AdopplerAdapter) bidUri(ext *openrtb_ext.ExtImpAdoppler) (string, error) {
func (ads *adapter) bidUri(ext *openrtb_ext.ExtImpElementalTV) (string, error) {
params := macros.EndpointTemplateParams{}
params.AdUnit = url.PathEscape(ext.AdUnit)
if ext.Client == "" {
params.AccountID = DefaultClient
} else {
params.AccountID = url.PathEscape(ext.Client)
}

return macros.ResolveMacros(ads.endpoint, params)
}

func unmarshalExt(ext json.RawMessage) (*openrtb_ext.ExtImpAdoppler, error) {
func unmarshalExt(ext json.RawMessage) (*openrtb_ext.ExtImpElementalTV, error) {
var bext adapters.ExtImpBidder
err := jsonutil.Unmarshal(ext, &bext)
if err != nil {
return nil, err
}

var adsExt openrtb_ext.ExtImpAdoppler
var adsExt openrtb_ext.ExtImpElementalTV
err = jsonutil.Unmarshal(bext.Bidder, &adsExt)
if err != nil {
return nil, err
}

if adsExt.AdUnit == "" {
return nil, errors.New("$.imp.ext.adoppler.adunit required")
return nil, &errortypes.BadInput{
Message: "$.imp.ext.bidder.adunit required",
}
}

return &adsExt, nil
Expand Down
19 changes: 19 additions & 0 deletions adapters/elementaltv/elementaltv_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package elementaltv
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR is missing params_test.go, You can refer other adapters for reference.

Copy link
Author

Choose a reason for hiding this comment

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

Done


import (
"testing"

"github.com/prebid/prebid-server/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/stretchr/testify/require"
)

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderElementalTV, config.Adapter{
Endpoint: "https://pbs.elementaltv.io/processHeaderBid/{{.AdUnit}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})

require.NoError(t, buildErr, "Builder returned unexpected error")

adapterstest.RunJSONBidderTest(t, "elementaltvtest", bidder)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down Expand Up @@ -86,7 +86,7 @@
},
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit2",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit2",
"body":{
"id":"req1-unit2",
"imp":[
Expand Down Expand Up @@ -141,7 +141,7 @@
},
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit3",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit3",
"body":{
"id":"req1-unit3",
"imp":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down Expand Up @@ -73,7 +73,7 @@
},
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit2",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit2",
"body":{
"id":"req1-unit2",
"imp":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down Expand Up @@ -86,7 +86,7 @@
},
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit2",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit2",
"body":{
"id":"req1-unit2",
"imp":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"expectedMakeRequestsErrors":[
{
"value":"$.imp.ext.adoppler.adunit required",
"value":"$.imp.ext.bidder.adunit required",
"comparison":"literal"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"httpCalls":[
{
"expectedRequest":{
"uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1",
"uri":"https://pbs.elementaltv.io/processHeaderBid/unit1",
"body":{
"id":"req1-unit1",
"imp":[
Expand Down
38 changes: 38 additions & 0 deletions adapters/elementaltv/params_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package elementaltv

import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/stretchr/testify/require"
)

func TestValidParams(t *testing.T) {
validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params")
require.NoErrorf(t, err, "Failed to fetch the json schema: %v", err)
for _, p := range validParams {
err := validator.Validate(openrtb_ext.BidderElementalTV, json.RawMessage(p))
require.NoError(t, err, "Schema rejected valid params: %s", p)
}
}

func TestInvalidParams(t *testing.T) {
validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params")
require.NoErrorf(t, err, "Failed to fetch the json schema: %v", err)

for _, p := range invalidParams {
err := validator.Validate(openrtb_ext.BidderElementalTV, json.RawMessage(p))
require.Error(t, err, "Schema allowed invalid params: %s", p)
}
}

var validParams = []string{
`{"adunit":"123"}`,
`{"adunit":"SSP:123"}`,
`{"adunit":"5346"}`}

var invalidParams = []string{
`{}`,
`{"adunitt":"123"}`,
}
Loading
Loading