Search in sources :

Example 6 with Ext

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method getExpectedUser.

private User getExpectedUser() {
    final User user = new User();
    user.id = USER_ID;
    user.yob = USER_YOB;
    user.keywords = USER_KEYWORDS;
    user.customData = USER_CUSTOM;
    user.gender = USER_GENDER;
    user.buyerUid = USER_BUYER_ID;
    user.ext = new Ext();
    user.ext.put("eids", Targeting.getEids());
    final Geo userGeo = user.getGeo();
    userGeo.lat = USER_LAT;
    userGeo.lon = USER_LON;
    return user;
}
Also used : Ext(org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext) Geo(org.prebid.mobile.rendering.models.openrtb.bidRequests.devices.Geo) User(org.prebid.mobile.rendering.models.openrtb.bidRequests.User)

Example 7 with Ext

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method whenAppendParametersAndAdConfigContextDataNotEmpty_ContextDataAddedToImpExt.

@Test
public void whenAppendParametersAndAdConfigContextDataNotEmpty_ContextDataAddedToImpExt() throws JSONException {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.addContextData("context", "contextData");
    BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), false);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    Ext impExt = adRequestInput.getBidRequest().getImp().get(0).getExt();
    assertTrue(impExt.getMap().containsKey("context"));
    JSONObject contextDataJson = ((JSONObject) impExt.getMap().get("context")).getJSONObject("data");
    assertTrue(contextDataJson.has("context"));
    assertEquals("contextData", contextDataJson.getJSONArray("context").get(0));
}
Also used : Ext(org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext) JSONObject(org.json.JSONObject) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BasicParameterBuilder(org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder) Test(org.junit.Test)

Example 8 with Ext

use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext in project prebid-mobile-android by prebid.

the class NativeEventTrackerTest method whenSetExt_ExtWasSet.

@Test
public void whenSetExt_ExtWasSet() {
    Ext ext = new Ext();
    ext.put("test", "test");
    ArrayList<NativeEventTracker.EventTrackingMethod> eventTrackingMethods = new ArrayList<>();
    eventTrackingMethods.add(NativeEventTracker.EventTrackingMethod.IMAGE);
    NativeEventTracker nativeEventTracker = new NativeEventTracker(NativeEventTracker.EventType.IMPRESSION, eventTrackingMethods);
    nativeEventTracker.setExt(ext);
    assertEquals(ext.getJsonObject().toString(), nativeEventTracker.getExt().getJsonObject().toString());
}
Also used : Ext(org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Ext (org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext)8 Test (org.junit.Test)5 JSONArray (org.json.JSONArray)3 JSONObject (org.json.JSONObject)3 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)3 User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)2 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)2 ArrayList (java.util.ArrayList)1 JSONException (org.json.JSONException)1 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)1 Geo (org.prebid.mobile.rendering.models.openrtb.bidRequests.devices.Geo)1