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 JSONArraygetCurrencyJson()Get currency json array final static JSONObjectgetMeasurementJson()Generates a JSON object containing measurement information, including partner name and SDK version. 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 static UnitaddParamToJson(JSONObject json, String key, String param)Helps you add new key and value to the json object. -
-
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.
-
getCurrencyJson
final static JSONArray getCurrencyJson()
Get currency json array
- Returns:
currency of type json array
-
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.
-
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
-
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.
-
-
-
-