Search in sources :

Example 1 with Format

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format in project prebid-mobile-android by prebid.

the class Banner method getJsonObject.

public JSONObject getJsonObject() throws JSONException {
    JSONObject jsonObject = new JSONObject();
    toJSON(jsonObject, "pos", this.pos);
    if (api != null) {
        JSONArray jsonArray = new JSONArray();
        for (int apiItem : api) {
            jsonArray.put(apiItem);
        }
        toJSON(jsonObject, "api", jsonArray);
    }
    if (mFormats.size() > 0) {
        JSONArray formatsArray = new JSONArray();
        for (Format format : mFormats) {
            formatsArray.put(format.getJsonObject());
        }
        toJSON(jsonObject, "format", formatsArray);
    }
    return jsonObject;
}
Also used : Format(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray)

Example 2 with Format

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method whenAppendParametersAndBInterstitialType_ImpWithValidBannerObject.

@Test
public void whenAppendParametersAndBInterstitialType_ImpWithValidBannerObject() throws JSONException {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.INTERSTITIAL);
    adConfiguration.setAdPosition(AdPosition.FULLSCREEN);
    BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    BidRequest actualBidRequest = adRequestInput.getBidRequest();
    BidRequest expectedBidRequest = getExpectedBidRequest(adConfiguration, actualBidRequest.getId());
    assertEquals(expectedBidRequest.getJsonObject().toString(), actualBidRequest.getJsonObject().toString());
    Imp actualImp = actualBidRequest.getImp().get(0);
    assertNotNull(actualImp.banner);
    Format expectedFormat = new Format(1920, 1080);
    assertTrue(actualImp.banner.getFormats().contains(expectedFormat));
    assertNull(actualImp.video);
    assertEquals(1, actualImp.secure.intValue());
    assertEquals(1, actualImp.instl.intValue());
}
Also used : Format(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BasicParameterBuilder(org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder) Imp(org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Aggregations

Format (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format)2 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1 Test (org.junit.Test)1 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)1 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)1 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)1 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)1