-
Notifications
You must be signed in to change notification settings - Fork 220
Mobkoi Adapter: set integration_type field in bid requests #4080
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.prebid.server.bidder.mobkoi.proto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Value; | ||
|
||
@Value(staticConstructor = "of") | ||
public class MobkoiBidRequestExt { | ||
|
||
@JsonProperty("mobkoi") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for |
||
final Mobkoi mobkoi; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for |
||
|
||
public static MobkoiBidRequestExt of() { | ||
return new MobkoiBidRequestExt(Mobkoi.of()); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this static constructor
|
||
|
||
@Value(staticConstructor = "of") | ||
public static class Mobkoi { | ||
|
||
@JsonProperty("integration_type") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for |
||
final String integrationType = "pbs"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ public class ExtImpMobkoi { | |
@JsonProperty("placementId") | ||
String placementId; | ||
|
||
@JsonProperty("adServerBaseUrl") | ||
String adServerBaseUrl; | ||
/** | ||
* The integration endpoint that the bid requests will be sent to. For example, https://test.mobkoi.com/bid. | ||
*/ | ||
Comment on lines
+12
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for this comment |
||
@JsonProperty("integrationEndpoint") | ||
String integrationEndpoint; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ | |
}, | ||
"adServerBaseUrl": { | ||
"type": "string", | ||
"description": "Mobkoi's ad server url", | ||
"pattern": "^https?://[^.]+\\.mobkoi\\.com$" | ||
"description": "Mobkoi's integration endpoint that will be used to send the bid requests to. For example, https://test.mobkoi.com/bid.", | ||
"pattern": "^https?://[^.]+\\.mobkoi\\.com(/.*)?$" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,24 @@ public void makeHttpRequestsShouldOverrideUserExtAndSetConsent() { | |
assertThat(result.getErrors()).isEmpty(); | ||
} | ||
|
||
@Test | ||
public void makeHttpRequestsShouldHasMobkoiExtSet() { | ||
// given | ||
final BidRequest bidRequest = givenBidRequest(identity()); | ||
|
||
// when | ||
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest); | ||
|
||
// then | ||
assertThat(result.getValue()) | ||
.extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class)) | ||
.extracting(request -> request.getExt()) | ||
.extracting(ext -> ext.getProperty("mobkoi")) | ||
.extracting(mobkoi -> mobkoi.get("integration_type").asText()) | ||
.hasSize(1).element(0) | ||
.isEqualTo("pbs"); | ||
} | ||
|
||
@Test | ||
public void makeBidsShouldReturnEmptyListIfBidResponseIsNull() throws JsonProcessingException { | ||
// given | ||
|
@@ -238,8 +256,13 @@ private static Imp givenImp(UnaryOperator<Imp.ImpBuilder> impCustomizer) { | |
return impCustomizer.apply(Imp.builder().id("imp_id").ext(impExt("placementIdValue", null))).build(); | ||
} | ||
|
||
private static ObjectNode impExt(String placementId, String adServerBaseUrl) { | ||
return mapper.valueToTree(ExtPrebid.of(null, ExtImpMobkoi.of(placementId, adServerBaseUrl))); | ||
/** | ||
* @param placementId The placement id provided by Mobkoi. | ||
* @param integrationEndpoint The integration endpoint that will be used to send the bid requests to. | ||
* @return The imp ext. | ||
*/ | ||
Comment on lines
+259
to
+263
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this comment |
||
private static ObjectNode impExt(String placementId, String integrationEndpoint) { | ||
return mapper.valueToTree(ExtPrebid.of(null, ExtImpMobkoi.of(placementId, integrationEndpoint))); | ||
} | ||
|
||
private static BidResponse givenBidResponse(UnaryOperator<Bid.BidBuilder> bidCustomizer) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this comment