Object POBCommonOrtbJsonHelper

  • All Implemented Interfaces:

    
    public class POBCommonOrtbJsonHelper
    
                        

    Helper object keeps common ORTB json objects/APIs

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • 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.

      • 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

      • 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.