diff --git a/src/main/java/org/prebid/server/bidder/unruly/UnrulyBidder.java b/src/main/java/org/prebid/server/bidder/unruly/UnrulyBidder.java index face5d03bc4..c98ca5e63d2 100644 --- a/src/main/java/org/prebid/server/bidder/unruly/UnrulyBidder.java +++ b/src/main/java/org/prebid/server/bidder/unruly/UnrulyBidder.java @@ -59,7 +59,7 @@ public Result>> makeHttpRequests(BidRequest request } final List> outgoingRequests = modifiedImps.stream() - .map(imp -> createSingleRequest(imp, request, endpointUrl)) + .map(imp -> createSingleRequest(imp, request)) .collect(Collectors.toList()); return Result.of(outgoingRequests, errors); @@ -85,8 +85,7 @@ private Imp modifyImp(Imp imp, ExtImpUnruly extImpUnruly) { return modifiedImp.build(); } - private HttpRequest createSingleRequest(Imp modifiedImp, BidRequest request, - String endpointUrl) { + private HttpRequest createSingleRequest(Imp modifiedImp, BidRequest request) { final BidRequest outgoingRequest = request.toBuilder().imp(Collections.singletonList(modifiedImp)).build(); return HttpRequest.builder() @@ -132,7 +131,11 @@ private static List bidsFromResponse(BidRequest bidRequest, BidRespon private static BidType getBidType(String impId, List imps) { for (Imp imp : imps) { if (imp.getId().equals(impId)) { - return BidType.video; + if (imp.getBanner() != null) { + return BidType.banner; + } else if (imp.getVideo() != null) { + return BidType.video; + } } } throw new PreBidException(String.format("Failed to find impression %s", impId)); diff --git a/src/main/java/org/prebid/server/proto/openrtb/ext/request/unruly/ExtImpUnruly.java b/src/main/java/org/prebid/server/proto/openrtb/ext/request/unruly/ExtImpUnruly.java index 50c2d047781..b20b52250c7 100644 --- a/src/main/java/org/prebid/server/proto/openrtb/ext/request/unruly/ExtImpUnruly.java +++ b/src/main/java/org/prebid/server/proto/openrtb/ext/request/unruly/ExtImpUnruly.java @@ -11,8 +11,6 @@ @AllArgsConstructor(staticName = "of") public class ExtImpUnruly { - String uuid; - @JsonProperty("siteid") - String siteId; + Integer siteId; } diff --git a/src/main/resources/bidder-config/unruly.yaml b/src/main/resources/bidder-config/unruly.yaml index 17034bd23c8..815e45f4ecd 100644 --- a/src/main/resources/bidder-config/unruly.yaml +++ b/src/main/resources/bidder-config/unruly.yaml @@ -1,14 +1,16 @@ adapters: unruly: - endpoint: http://targeting.unrulymedia.com/openrtb/2.2 + endpoint: https://targeting.unrulymedia.com/unruly_prebid_server meta-info: - maintainer-email: adspaces@unrulygroup.com + maintainer-email: prebidsupport@unrulygroup.com app-media-types: + - banner - video site-media-types: + - banner - video supported-vendors: - vendor-id: 162 + vendor-id: 36 usersync: url: https://sync.1rx.io/usersync2/rmphb?gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&redir= redirect-url: /setuid?bidder=unruly&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&uid=[RX_UUID] diff --git a/src/main/resources/static/bidder-params/unruly.json b/src/main/resources/static/bidder-params/unruly.json index b4d630a1c52..42a76c3f7f3 100644 --- a/src/main/resources/static/bidder-params/unruly.json +++ b/src/main/resources/static/bidder-params/unruly.json @@ -4,17 +4,12 @@ "description": "A schema which validates params accepted by the Unruly adapter", "type": "object", "properties": { - "uuid": { - "type": "string", - "description": "uuid" - }, "siteid": { - "type": "string", + "type": "integer", "description": "ID for publisher site" } }, "required": [ - "uuid", "siteid" ] } diff --git a/src/test/java/org/prebid/server/bidder/unruly/UnrulyBidderTest.java b/src/test/java/org/prebid/server/bidder/unruly/UnrulyBidderTest.java index 190fac300b9..8fcb629a913 100644 --- a/src/test/java/org/prebid/server/bidder/unruly/UnrulyBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/unruly/UnrulyBidderTest.java @@ -1,6 +1,7 @@ package org.prebid.server.bidder.unruly; import com.fasterxml.jackson.core.JsonProcessingException; +import com.iab.openrtb.request.Banner; import com.iab.openrtb.request.BidRequest; import com.iab.openrtb.request.Imp; import com.iab.openrtb.request.Video; @@ -29,6 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.tuple; +import static org.prebid.server.proto.openrtb.ext.response.BidType.banner; import static org.prebid.server.proto.openrtb.ext.response.BidType.video; public class UnrulyBidderTest extends VertxTest { @@ -131,7 +133,7 @@ public void makeBidsShouldReturnVideoBid() throws JsonProcessingException { // given final HttpCall httpCall = givenHttpCall( BidRequest.builder() - .imp(singletonList(Imp.builder().id("123").build())) + .imp(singletonList(Imp.builder().video(Video.builder().build()).id("123").build())) .build(), mapper.writeValueAsString( givenBidResponse(bidBuilder -> bidBuilder.impid("123")))); @@ -145,6 +147,25 @@ public void makeBidsShouldReturnVideoBid() throws JsonProcessingException { .containsOnly(BidderBid.of(Bid.builder().impid("123").build(), video, "USD")); } + @Test + public void makeBidsShouldReturnBannerBid() throws JsonProcessingException { + // given + final HttpCall httpCall = givenHttpCall( + BidRequest.builder() + .imp(singletonList(Imp.builder().banner(Banner.builder().build()).id("123").build())) + .build(), + mapper.writeValueAsString( + givenBidResponse(bidBuilder -> bidBuilder.impid("123")))); + + // when + final Result> result = unrulyBidder.makeBids(httpCall, null); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()) + .containsOnly(BidderBid.of(Bid.builder().impid("123").build(), banner, "USD")); + } + @Test public void makeBidsShouldReturnErrorIfImpressionWasNotFound() throws JsonProcessingException { // given @@ -169,7 +190,7 @@ private static BidRequest givenBidRequest( Function impCustomizer) { return bidRequestCustomizer.apply(BidRequest.builder() - .imp(singletonList(givenImp(impCustomizer)))) + .imp(singletonList(givenImp(impCustomizer)))) .build(); } @@ -179,9 +200,9 @@ private static BidRequest givenBidRequest(Function impCustomizer) { return impCustomizer.apply(Imp.builder() - .id("123") - .video(Video.builder().build()) - .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpUnruly.of("uuid", "site_id"))))) + .id("123") + .video(Video.builder().build()) + .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpUnruly.of(123))))) .build(); } diff --git a/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-auction-unruly-request.json b/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-auction-unruly-request.json index 66c0070a37a..9842f5584fc 100644 --- a/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-auction-unruly-request.json +++ b/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-auction-unruly-request.json @@ -12,8 +12,7 @@ }, "ext": { "unruly": { - "uuid": "uu_id_1", - "siteid": "site_id_1" + "siteid": 123 } } } @@ -24,4 +23,4 @@ "gdpr": 0 } } -} \ No newline at end of file +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-unruly-bid-request.json b/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-unruly-bid-request.json index f334cef507c..3bf8946422e 100644 --- a/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-unruly-bid-request.json +++ b/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-unruly-bid-request.json @@ -12,8 +12,7 @@ }, "ext": { "unruly": { - "uuid": "uu_id_1", - "siteid": "site_id_1" + "siteid": 123 } } } @@ -42,4 +41,4 @@ "gdpr": 0 } } -} \ No newline at end of file +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-unruly-bid-response.json b/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-unruly-bid-response.json index 6c59f41f84e..c43a8ca5bac 100644 --- a/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-unruly-bid-response.json +++ b/src/test/resources/org/prebid/server/it/openrtb2/unruly/test-unruly-bid-response.json @@ -9,6 +9,11 @@ "price": 1.25, "crid": "crid", "adm": "adm001", + "ext": { + "prebid": { + "type": "video" + } + }, "h": 600, "w": 800 } @@ -16,4 +21,4 @@ } ], "bidid": "bid001" -} \ No newline at end of file +}