Object POBCommonOrtbJsonHelper
-
- All Implemented Interfaces:
public class POBCommonOrtbJsonHelperHelper object keeps common ORTB json objects/APIs
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringTAGpublic final static POBCommonOrtbJsonHelperINSTANCE
-
Method Summary
Modifier and Type Method Description final static JSONArraygetImpressionJsonArray(POBRequest request)Generates a JSONArray of impressions from a given POBRequest. final static JSONObjectgetDeviceObject(POBDeviceInfo deviceInfo, POBLocationDetector locationDetector, Context context)Builds oRTB specific device info json, Internally it uses device info POBDeviceInfo to fetch device specific values. final static JSONObjectgetMeasurementJson()Generates a JSON object containing measurement information, including partner name and SDK version. final static UnitaddDsaData(JSONObject regsExt)final static JSONObjectgetUserJson(Context context, POBAdFormat placementType)Create ortb user json for ad request final static JSONObjectgetRegsJson(Context context)Create ortb regs json for ad request final UnitaddGpp(Context context, JSONObject regsExt)Add GPP to regs ext json if available in shared preference. final UnitaddGppSid(Context context, JSONObject regsExt)Add GPP SID to regs ext json if available in shared preference. final static UnitaddParamToJson(JSONObject json, String key, String param)Helps you add new key and value to the json object. final static JSONArraygetUserDataJson(POBUserInfo userInfo)final JSONObjectgetUserExtJson(Context context, POBAdFormat placementType)final UnitaddImpDepth(Context context, POBAdFormat placementType, JSONObject userExtJsonObject)final UnitaddGdprConsent(Context context, JSONObject userExt)final UnitaddUserIds(JSONObject userExt)final UnitaddSessionDuration(Context context, JSONObject userExt)final JSONArraybuildUidJsonArray(List<POBExternalUserId> userIds)final static JSONObjectgetGeoObject(POBLocationDetector locationDetector, POBDeviceInfo deviceInfo)-
-
Method Detail
-
getImpressionJsonArray
final static JSONArray getImpressionJsonArray(POBRequest request)
Generates a JSONArray of impressions from a given POBRequest. Iterates through each impression in the request, converts it to a JSONObject using getImpressionJson(), and adds it to the JSONArray. Any JSONException encountered during the conversion is logged as an error.
- Parameters:
request- The POBRequest containing impressions to be converted.- Returns:
A JSONArray containing the converted impressions.
-
getDeviceObject
final static JSONObject getDeviceObject(POBDeviceInfo deviceInfo, POBLocationDetector locationDetector, Context context)
Builds oRTB specific device info json, Internally it uses device info POBDeviceInfo to fetch device specific values.
- Returns:
the device json
-
getMeasurementJson
final static JSONObject getMeasurementJson()
Generates a JSON object containing measurement information, including partner name and SDK version. This information is structured under an 'ext' key. If an error occurs during JSON object creation, the error is logged, and null is returned.
-
addDsaData
final static Unit addDsaData(JSONObject regsExt)
-
getUserJson
final static JSONObject getUserJson(Context context, POBAdFormat placementType)
Create ortb user json for ad request
- Returns:
the user json
-
getRegsJson
final static JSONObject getRegsJson(Context context)
Create ortb regs json for ad request
- Returns:
the regs json
-
addGpp
final Unit addGpp(Context context, JSONObject regsExt)
Add GPP to regs ext json if available in shared preference.
- Parameters:
context- the application contextregsExt- the regs ext json object
-
addGppSid
final Unit addGppSid(Context context, JSONObject regsExt)
Add GPP SID to regs ext json if available in shared preference.
- Parameters:
context- the application context
-
addParamToJson
final static Unit addParamToJson(JSONObject json, String key, String param)
Helps you add new key and value to the json object. Adds a parameter to a JSON object if the parameter is not null or empty. If the JSON object is not null and the parameter value is valid, the parameter is added to the JSON object with the specified key. If the operation fails due to a JSONException, a warning is logged.
- Parameters:
json- The JSON object to which the parameter should be added.key- The key under which the parameter should be added.param- The parameter value to add; it will be ignored if null or empty.
-
getUserDataJson
final static JSONArray getUserDataJson(POBUserInfo userInfo)
-
getUserExtJson
final JSONObject getUserExtJson(Context context, POBAdFormat placementType)
-
addImpDepth
final Unit addImpDepth(Context context, POBAdFormat placementType, JSONObject userExtJsonObject)
-
addGdprConsent
final Unit addGdprConsent(Context context, JSONObject userExt)
-
addUserIds
final Unit addUserIds(JSONObject userExt)
-
addSessionDuration
final Unit addSessionDuration(Context context, JSONObject userExt)
-
buildUidJsonArray
final JSONArray buildUidJsonArray(List<POBExternalUserId> userIds)
-
getGeoObject
final static JSONObject getGeoObject(POBLocationDetector locationDetector, POBDeviceInfo deviceInfo)
-
-
-
-