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

VerizonMedia rebranding into YSSP #1439

Merged
merged 3 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 org.prebid.server.bidder.verizonmedia;
package org.prebid.server.bidder.yssp;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.node.ObjectNode;
Expand All @@ -25,7 +25,7 @@
import org.prebid.server.json.DecodeException;
import org.prebid.server.json.JacksonMapper;
import org.prebid.server.proto.openrtb.ext.ExtPrebid;
import org.prebid.server.proto.openrtb.ext.request.verizonmedia.ExtImpVerizonmedia;
import org.prebid.server.proto.openrtb.ext.request.yssp.ExtImpYssp;
import org.prebid.server.proto.openrtb.ext.response.BidType;
import org.prebid.server.util.HttpUtil;

Expand All @@ -36,16 +36,16 @@
import java.util.Objects;
import java.util.stream.Collectors;

public class VerizonmediaBidder implements Bidder<BidRequest> {
public class YsspBidder implements Bidder<BidRequest> {

private static final TypeReference<ExtPrebid<?, ExtImpVerizonmedia>> VERIZON_EXT_TYPE_REFERENCE =
new TypeReference<ExtPrebid<?, ExtImpVerizonmedia>>() {
private static final TypeReference<ExtPrebid<?, ExtImpYssp>> YSSP_EXT_TYPE_REFERENCE =
new TypeReference<ExtPrebid<?, ExtImpYssp>>() {
};

private final String endpointUrl;
private final JacksonMapper mapper;

public VerizonmediaBidder(String endpointUrl, JacksonMapper mapper) {
public YsspBidder(String endpointUrl, JacksonMapper mapper) {
this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl));
this.mapper = Objects.requireNonNull(mapper);
}
Expand All @@ -59,8 +59,8 @@ public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest bidRequ
for (int i = 0; i < impList.size(); i++) {
try {
final Imp imp = impList.get(i);
final ExtImpVerizonmedia extImpVerizonmedia = parseAndValidateImpExt(imp.getExt(), i);
final BidRequest modifiedRequest = modifyRequest(bidRequest, imp, extImpVerizonmedia);
final ExtImpYssp extImpYssp = parseAndValidateImpExt(imp.getExt(), i);
final BidRequest modifiedRequest = modifyRequest(bidRequest, imp, extImpYssp);
bidRequests.add(makeHttpRequest(modifiedRequest));
} catch (PreBidException e) {
errors.add(BidderError.badInput(e.getMessage()));
Expand All @@ -70,28 +70,28 @@ public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest bidRequ
return Result.of(bidRequests, errors);
}

private ExtImpVerizonmedia parseAndValidateImpExt(ObjectNode impExtNode, int index) {
final ExtImpVerizonmedia extImpVerizonmedia;
private ExtImpYssp parseAndValidateImpExt(ObjectNode impExtNode, int index) {
final ExtImpYssp extImpYssp;
try {
extImpVerizonmedia = mapper.mapper().convertValue(impExtNode, VERIZON_EXT_TYPE_REFERENCE).getBidder();
extImpYssp = mapper.mapper().convertValue(impExtNode, YSSP_EXT_TYPE_REFERENCE).getBidder();
} catch (IllegalArgumentException e) {
throw new PreBidException(String.format("imp #%s: %s", index, e.getMessage()));
}

final String dcn = extImpVerizonmedia.getDcn();
final String dcn = extImpYssp.getDcn();
if (StringUtils.isBlank(dcn)) {
throw new PreBidException(String.format("imp #%s: missing param dcn", index));
}

final String pos = extImpVerizonmedia.getPos();
final String pos = extImpYssp.getPos();
if (StringUtils.isBlank(pos)) {
throw new PreBidException(String.format("imp #%s: missing param pos", index));
}

return extImpVerizonmedia;
return extImpYssp;
}

private static BidRequest modifyRequest(BidRequest request, Imp imp, ExtImpVerizonmedia extImpVerizonmedia) {
private static BidRequest modifyRequest(BidRequest request, Imp imp, ExtImpYssp extImpYssp) {
final Banner banner = imp.getBanner();
final boolean hasBanner = banner != null;

Expand All @@ -105,7 +105,7 @@ private static BidRequest modifyRequest(BidRequest request, Imp imp, ExtImpVeriz
}

final Imp.ImpBuilder impBuilder = imp.toBuilder()
.tagid(extImpVerizonmedia.getPos());
.tagid(extImpYssp.getPos());

if (hasBanner && !hasBannerWidthAndHeight) {
impBuilder.banner(modifyBanner(banner));
Expand All @@ -116,9 +116,9 @@ private static BidRequest modifyRequest(BidRequest request, Imp imp, ExtImpVeriz
final Site site = request.getSite();
final App app = request.getApp();
if (site != null) {
requestBuilder.site(site.toBuilder().id(extImpVerizonmedia.getDcn()).build());
requestBuilder.site(site.toBuilder().id(extImpYssp.getDcn()).build());
} else if (app != null) {
requestBuilder.app(app.toBuilder().id(extImpVerizonmedia.getDcn()).build());
requestBuilder.app(app.toBuilder().id(extImpYssp.getDcn()).build());
}

return requestBuilder
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.prebid.server.proto.openrtb.ext.request.yssp;

import lombok.AllArgsConstructor;
import lombok.Value;

/**
* Defines the contract for bidRequest.imp[i].ext.yssp
*/
@AllArgsConstructor(staticName = "of")
@Value
public class ExtImpYssp {

String dcn;

String pos;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.prebid.server.spring.config.bidder;

import org.prebid.server.bidder.BidderDeps;
import org.prebid.server.bidder.verizonmedia.VerizonmediaBidder;
import org.prebid.server.bidder.yssp.YsspBidder;
import org.prebid.server.json.JacksonMapper;
import org.prebid.server.spring.config.bidder.model.BidderConfigurationProperties;
import org.prebid.server.spring.config.bidder.util.BidderDepsAssembler;
Expand All @@ -18,10 +18,10 @@
import javax.validation.constraints.NotBlank;

@Configuration
@PropertySource(value = "classpath:/bidder-config/verizonmedia.yaml", factory = YamlPropertySourceFactory.class)
public class VerizonmediaConfiguration {
@PropertySource(value = "classpath:/bidder-config/yssp.yaml", factory = YamlPropertySourceFactory.class)
public class YsspConfiguration {

private static final String BIDDER_NAME = "verizonmedia";
private static final String BIDDER_NAME = "yssp";

@Value("${external-url}")
@NotBlank
Expand All @@ -31,21 +31,21 @@ public class VerizonmediaConfiguration {
private JacksonMapper mapper;

@Autowired
@Qualifier("verizonmediaConfigurationProperties")
@Qualifier("ysspConfigurationProperties")
private BidderConfigurationProperties configProperties;

@Bean("verizonmediaConfigurationProperties")
@ConfigurationProperties("adapters.verizonmedia")
@Bean("ysspConfigurationProperties")
@ConfigurationProperties("adapters.yssp")
BidderConfigurationProperties configurationProperties() {
return new BidderConfigurationProperties();
}

@Bean
BidderDeps verizonmediaBidderDeps() {
BidderDeps ysspBidderDeps() {
return BidderDepsAssembler.forBidder(BIDDER_NAME)
.withConfig(configProperties)
.usersyncerCreator(UsersyncerCreator.create(externalUrl))
.bidderCreator(config -> new VerizonmediaBidder(config.getEndpoint(), mapper))
.bidderCreator(config -> new YsspBidder(config.getEndpoint(), mapper))
.assemble();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
adapters:
verizonmedia:
yssp:
enabled: false
endpoint: https://s2shb.ssp.yahoo.com/admax/bid/partners/MAG
pbs-enforces-gdpr: true
pbs-enforces-ccpa: true
modifying-vast-xml-allowed: true
deprecated-names:
aliases: {}
aliases:
verizonmedia:
enabled: false
meta-info:
maintainer-email: dsp-supply-prebid@verizonmedia.com
app-media-types:
Expand All @@ -18,6 +20,6 @@ adapters:
usersync:
url: https://ups.analytics.yahoo.com/ups/58401/sync?redir=true&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}
redirect-url:
cookie-family-name: verizonmedia
cookie-family-name: yssp
type: redirect
support-cors: false
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "VerizonMedia Adapter Params",
"description": "A schema which validates params accepted by the VerizonMedia adapter",
"title": "YSSP Adapter Params",
"description": "A schema which validates params accepted by the YSSP adapter",
"type": "object",
"properties": {
"dcn": {
Expand Down
Loading