com.sponsorpay.sdk.android
Class UrlBuilder

java.lang.Object
  extended by com.sponsorpay.sdk.android.UrlBuilder

public class UrlBuilder
extends java.lang.Object

Contains utility methods to build URLs used to access the SponsorPay's back-end API.


Field Summary
private static java.lang.String ANDROID_ID_KEY
          The Android ID key for encoding the corresponding URL parameter.
private static java.lang.String APPID_KEY
          The App ID key for encoding the corresponding URL parameter.
private static java.lang.String LANGUAGE_KEY
          The default language setting key for encoding the corresponding URL parameter.
private static java.lang.String OS_VERSION_KEY
          The OS version key for encoding the corresponding URL parameter.
private static java.lang.String PHONE_VERSION_KEY
          The phone model key for encoding the corresponding URL parameter.
private static java.lang.String SDK_INTERNAL_VERSION_KEY
          The SDK internal version key for encoding the corresponding URL parameter.
private static java.lang.String SDK_RELEASE_VERSION_KEY
          The SDK release version key for encoding the corresponding URL parameter.
private static java.lang.String UDID_KEY
          The unique device ID (for url-encoding).
static java.lang.String URL_PARAM_ALLOW_CAMPAIGN_KEY
           
static java.lang.String URL_PARAM_CURRENCY_NAME_KEY
           
static java.lang.String URL_PARAM_OFFSET_KEY
           
private static java.lang.String URL_PARAM_SIGNATURE
          Request signature parameter key.
static java.lang.String URL_PARAM_VALUE_ON
           
private static java.lang.String USERID_KEY
          The user id key for encoding the corresponding URL parameter.
private static java.lang.String WIFI_MAC_ADDRESS_KEY
          The WiFi MAC Address ID key for encoding the corresponding URL parameter.
 
Constructor Summary
UrlBuilder()
           
 
Method Summary
static java.lang.String buildUrl(java.lang.String resourceUrl, HostInfo hostInfo, java.lang.String[] extraKeys, java.lang.String[] extraValues)
          Builds a String URL with information gathered from the device and the specified parameters.
static java.lang.String buildUrl(java.lang.String resourceUrl, java.lang.String userId, HostInfo hostInfo, java.lang.String[] extraKeys, java.lang.String[] extraValues)
          Builds a String URL with information gathered from the device and the specified parameters.
static java.lang.String buildUrl(java.lang.String resourceUrl, java.lang.String userId, HostInfo hostInfo, java.lang.String[] extraKeys, java.lang.String[] extraValues, java.lang.String secretKey)
          Builds a String URL with information gathered from the device and the specified parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UDID_KEY

private static final java.lang.String UDID_KEY
The unique device ID (for url-encoding).

See Also:
Constant Field Values

USERID_KEY

private static final java.lang.String USERID_KEY
The user id key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

APPID_KEY

private static final java.lang.String APPID_KEY
The App ID key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

OS_VERSION_KEY

private static final java.lang.String OS_VERSION_KEY
The OS version key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

PHONE_VERSION_KEY

private static final java.lang.String PHONE_VERSION_KEY
The phone model key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

LANGUAGE_KEY

private static final java.lang.String LANGUAGE_KEY
The default language setting key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

SDK_INTERNAL_VERSION_KEY

private static final java.lang.String SDK_INTERNAL_VERSION_KEY
The SDK internal version key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

SDK_RELEASE_VERSION_KEY

private static final java.lang.String SDK_RELEASE_VERSION_KEY
The SDK release version key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

ANDROID_ID_KEY

private static final java.lang.String ANDROID_ID_KEY
The Android ID key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

WIFI_MAC_ADDRESS_KEY

private static final java.lang.String WIFI_MAC_ADDRESS_KEY
The WiFi MAC Address ID key for encoding the corresponding URL parameter.

See Also:
Constant Field Values

URL_PARAM_SIGNATURE

private static final java.lang.String URL_PARAM_SIGNATURE
Request signature parameter key.

See Also:
Constant Field Values

URL_PARAM_ALLOW_CAMPAIGN_KEY

public static final java.lang.String URL_PARAM_ALLOW_CAMPAIGN_KEY
See Also:
Constant Field Values

URL_PARAM_VALUE_ON

public static final java.lang.String URL_PARAM_VALUE_ON
See Also:
Constant Field Values

URL_PARAM_OFFSET_KEY

public static final java.lang.String URL_PARAM_OFFSET_KEY
See Also:
Constant Field Values

URL_PARAM_CURRENCY_NAME_KEY

public static final java.lang.String URL_PARAM_CURRENCY_NAME_KEY
See Also:
Constant Field Values
Constructor Detail

UrlBuilder

public UrlBuilder()
Method Detail

buildUrl

public static java.lang.String buildUrl(java.lang.String resourceUrl,
                                        java.lang.String userId,
                                        HostInfo hostInfo,
                                        java.lang.String[] extraKeys,
                                        java.lang.String[] extraValues)
Builds a String URL with information gathered from the device and the specified parameters.

Parameters:
resourceUrl - The base for the URL to be built and returned, including schema and host.
userId - The user id parameter to encode in the result URL. It can be left to null and no user ID parameter key will be included in the request parameters.
hostInfo - A HostInfo instance used to retrieve data about the application id and the host device.
extraKeys - An array of keys for extra parameters to encode in the result URL.
extraValues - An array of values corresponding to the provided extraKeys.
Returns:
The built URL as a String with the provided parameters encoded.

buildUrl

public static java.lang.String buildUrl(java.lang.String resourceUrl,
                                        HostInfo hostInfo,
                                        java.lang.String[] extraKeys,
                                        java.lang.String[] extraValues)
Builds a String URL with information gathered from the device and the specified parameters.

Parameters:
resourceUrl - The base for the URL to be built and returned, including schema and host.
hostInfo - A HostInfo instance used to retrieve data about the application id and the host device.
extraKeys - An array of keys for extra parameters to encode in the result URL.
extraValues - An array of values corresponding to the provided extraKeys.
Returns:
The built URL as a String with the provided parameters encoded.

buildUrl

public static java.lang.String buildUrl(java.lang.String resourceUrl,
                                        java.lang.String userId,
                                        HostInfo hostInfo,
                                        java.lang.String[] extraKeys,
                                        java.lang.String[] extraValues,
                                        java.lang.String secretKey)
Builds a String URL with information gathered from the device and the specified parameters.

Parameters:
resourceUrl - The base for the URL to be built and returned, including schema and host.
userId - The user id parameter to encode in the result URL. It can be left to null and no user ID parameter key will be included in the request parameters.
hostInfo - A HostInfo instance used to retrieve data about the application id and the host device.
extraKeys - An array of keys for extra parameters to encode in the result URL.
extraValues - An array of values corresponding to the provided extraKeys.
secretKey - The publisher's secret token which will be used to sign the request. If left to null the request will be sent unsigned.
Returns:
The built URL as a String with the provided parameters encoded.