use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class MacrosResolutionHelperTest method resolveAuctionMacros_MultipleMatch_LocatedMacrosAreReplaced.
@Test
public void resolveAuctionMacros_MultipleMatch_LocatedMacrosAreReplaced() throws IOException, JSONException {
String actualResponseWithMacros = ResourceUtils.convertResourceToString("native_bid_response_macros.json");
String expectedResponseWithMacros = ResourceUtils.convertResourceToString("native_bid_response_macros_expected.json");
Map<String, MacrosModel> macrosModelMap = new HashMap<>();
Bid bid = Bid.fromJSONObject(new JSONObject(actualResponseWithMacros));
String id = bid.getId();
String price = String.valueOf(bid.getPrice());
String base64Price = Base64.getEncoder().encodeToString(price.getBytes());
macrosModelMap.put(MACROS_AUCTION_BID_ID, new MacrosModel(id));
macrosModelMap.put(MacrosModel.MACROS_AUCTION_PRICE, new MacrosModel(price));
macrosModelMap.put(MacrosModel.MACROS_AUCTION_PRICE_BASE_64, new MacrosModel(base64Price));
String macrosAfterResolution = MacrosResolutionHelper.resolveAuctionMacros(actualResponseWithMacros, macrosModelMap);
assertEquals(expectedResponseWithMacros, macrosAfterResolution);
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class CreativeModelMakerBids method parseAcj.
private void parseAcj(AdConfiguration adConfiguration, BidResponse bidResponse) {
CreativeModelsMaker.Result result = new CreativeModelsMaker.Result();
result.creativeModels = new ArrayList<>();
Bid bid = bidResponse.getWinningBid();
String adHtml = getAdHtml(adConfiguration, bid);
CreativeModel model = new CreativeModel(TrackingManager.getInstance(), new OmEventTracker(), adConfiguration);
model.setName("HTML");
model.setHtml(adHtml);
model.setWidth(bid != null ? bid.getWidth() : 0);
model.setHeight(bid != null ? bid.getHeight() : 0);
model.setRequireImpressionUrl(false);
adConfiguration.setInterstitialSize(model.getWidth(), model.getHeight());
result.creativeModels.add(model);
result.transactionState = "bid";
mListener.onCreativeModelReady(result);
}
Aggregations