Skip to content

Commit

Permalink
Smaato: Update Client Version (#3296)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoxaAntoxic authored Jul 10, 2024
1 parent 6518251 commit 519be8d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 49 deletions.
16 changes: 1 addition & 15 deletions src/main/java/org/prebid/server/bidder/smaato/SmaatoBidder.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.iab.openrtb.request.App;
import com.iab.openrtb.request.Banner;
import com.iab.openrtb.request.BidRequest;
import com.iab.openrtb.request.Format;
import com.iab.openrtb.request.Imp;
import com.iab.openrtb.request.Native;
import com.iab.openrtb.request.Publisher;
Expand Down Expand Up @@ -69,7 +68,7 @@ public class SmaatoBidder implements Bidder<BidRequest> {
private static final TypeReference<ExtPrebid<?, ExtImpSmaato>> SMAATO_EXT_TYPE_REFERENCE =
new TypeReference<>() {
};
private static final String CLIENT_VERSION = "prebid_server_0.4";
private static final String CLIENT_VERSION = "prebid_server_0.7";
private static final String SMT_ADTYPE_HEADER = "X-Smt-Adtype";
private static final String SMT_EXPIRES_HEADER = "X-Smt-Expires";
private static final String SMT_AD_TYPE_IMG = "Img";
Expand Down Expand Up @@ -311,25 +310,12 @@ private ObjectNode resolveImpExtSkadn(ObjectNode impExt) {
private List<Imp> modifyImpForAdSpace(Imp imp, String adSpaceId, ObjectNode impExtSkadn) {
final Imp modifiedImp = imp.toBuilder()
.tagid(adSpaceId)
.banner(getIfNotNull(imp.getBanner(), SmaatoBidder::modifyBanner))
.ext(impExtSkadn)
.build();

return Collections.singletonList(modifiedImp);
}

private static Banner modifyBanner(Banner banner) {
if (banner.getW() != null && banner.getH() != null) {
return banner;
}
final List<Format> format = banner.getFormat();
if (CollectionUtils.isEmpty(format)) {
throw new PreBidException("No sizes provided for Banner.");
}
final Format firstFormat = format.getFirst();
return banner.toBuilder().w(firstFormat.getW()).h(firstFormat.getH()).build();
}

private HttpRequest<BidRequest> constructHttpRequest(BidRequest bidRequest) {
return BidderUtil.defaultRequest(bidRequest, endpointUrl, mapper);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/bidder-config/smaato.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ adapters:
app-media-types:
- banner
- video
- native
site-media-types:
- banner
- video
- native
supported-vendors:
vendor-id: 82
# This bidder does not sync when GDPR is in-scope. Please consider removing the usersync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.iab.openrtb.request.App;
import com.iab.openrtb.request.Banner;
import com.iab.openrtb.request.BidRequest;
import com.iab.openrtb.request.Format;
import com.iab.openrtb.request.Imp;
import com.iab.openrtb.request.Native;
import com.iab.openrtb.request.Publisher;
Expand Down Expand Up @@ -139,7 +138,7 @@ public void makeHttpRequestsShouldSetExt() {
.extracting(HttpRequest::getPayload)
.extracting(BidRequest::getExt)
.containsExactly(jacksonMapper.fillExtension(ExtRequest.empty(),
SmaatoBidRequestExt.of("prebid_server_0.4")));
SmaatoBidRequestExt.of("prebid_server_0.7")));
}

@Test
Expand Down Expand Up @@ -509,19 +508,6 @@ public void makeIndividualHttpRequestsShouldReturnErrorIfSiteAndAppAreAbsentInRe
.containsExactly(BidderError.badInput("Missing Site/App."));
}

@Test
public void makeIndividualHttpRequestsShouldReturnErrorIfBannerSizesAndFormatsAreAbsent() {
// given
final BidRequest bidRequest = givenBidRequest(impBuilder -> impBuilder.banner(Banner.builder().build()));

// when
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);

// then
assertThat(result.getValue()).isEmpty();
assertThat(result.getErrors()).containsExactly(BidderError.badInput("No sizes provided for Banner."));
}

@Test
public void makeIndividualHttpRequestsShouldNotModifyBannerIfBannerSizesArePresent() {
// given
Expand All @@ -540,24 +526,6 @@ public void makeIndividualHttpRequestsShouldNotModifyBannerIfBannerSizesArePrese
.containsExactly(Banner.builder().w(1).h(1).build());
}

@Test
public void makeIndividualHttpRequestsShouldReplaceBannerSizesWithFirstFormatIfFormatsArePresent() {
// given
final Banner banner = Banner.builder().format(singletonList(Format.builder().w(2).h(2).build())).build();
final BidRequest bidRequest = givenBidRequest(impBuilder -> impBuilder.banner(banner));

// when
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);

// then
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue())
.extracting(HttpRequest::getPayload)
.flatExtracting(BidRequest::getImp)
.extracting(Imp::getBanner)
.containsExactly(banner.toBuilder().w(2).h(2).build());
}

@Test
public void makeIndividualHttpRequestsShouldSetImpTagIdAndRemoveImpExt() {
// given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
}
},
"ext": {
"client": "prebid_server_0.4"
"client": "prebid_server_0.7"
}
}

0 comments on commit 519be8d

Please sign in to comment.