com.sponsorpay.sdk.android.publisher.unlock
Class SponsorPayUnlockConnector

java.lang.Object
  extended by com.sponsorpay.sdk.android.publisher.AbstractConnector
      extended by com.sponsorpay.sdk.android.publisher.unlock.SponsorPayUnlockConnector
All Implemented Interfaces:
AsyncRequest.AsyncRequestResultListener, SPUnlockResponseListener

public class SponsorPayUnlockConnector
extends AbstractConnector
implements SPUnlockResponseListener

Provides services to access the SponsorPay Unlock Server.


Field Summary
private  SPUnlockResponseListener mUserListener
          SPUnlockResponseListener registered by the developer's code to be notified of the result of requests to the back end.
private static java.lang.String SP_UNLOCK_REQUEST_RESOURCE
           
private static java.lang.String SP_UNLOCK_SERVER_PRODUCTION_BASE_URL
           
private static java.lang.String SP_UNLOCK_SERVER_STAGING_BASE_URL
           
 
Fields inherited from class com.sponsorpay.sdk.android.publisher.AbstractConnector
mContext, mCustomParameters, mHostInfo, mSecurityToken, mUserId, remoteResourceUrl, URL_PARAM_KEY_TIMESTAMP
 
Constructor Summary
SponsorPayUnlockConnector(Context context, java.lang.String userId, SPUnlockResponseListener userListener, HostInfo hostInfo, java.lang.String securityToken)
          Initializes a new SponsorPayUnlockConnector instance.
 
Method Summary
 void fetchItemsStatus()
          Sends a request to fetch the status of the Unlock items.
 void onAsyncRequestComplete(AsyncRequest requestTask)
           
 void onSPUnlockItemsStatusResponseReceived(UnlockedItemsResponse response)
          Implemented from SPUnlockResponseListener.
 void onSPUnlockRequestError(AbstractResponse response)
          Implemented from SPUnlockResponseListener.
 
Methods inherited from class com.sponsorpay.sdk.android.publisher.AbstractConnector
getCurrentUnixTimestampAsString, setCustomParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SP_UNLOCK_SERVER_STAGING_BASE_URL

private static final java.lang.String SP_UNLOCK_SERVER_STAGING_BASE_URL
See Also:
Constant Field Values

SP_UNLOCK_SERVER_PRODUCTION_BASE_URL

private static final java.lang.String SP_UNLOCK_SERVER_PRODUCTION_BASE_URL
See Also:
Constant Field Values

SP_UNLOCK_REQUEST_RESOURCE

private static final java.lang.String SP_UNLOCK_REQUEST_RESOURCE
See Also:
Constant Field Values

mUserListener

private SPUnlockResponseListener mUserListener
SPUnlockResponseListener registered by the developer's code to be notified of the result of requests to the back end.

Constructor Detail

SponsorPayUnlockConnector

public SponsorPayUnlockConnector(Context context,
                                 java.lang.String userId,
                                 SPUnlockResponseListener userListener,
                                 HostInfo hostInfo,
                                 java.lang.String securityToken)
Initializes a new SponsorPayUnlockConnector instance.

Parameters:
context - Android application context.
userId - User ID.
userListener - Listener which will be notified of asynchronous responses to the requests sent by this app.
hostInfo - HostInfo containing information about the host app and device.
securityToken - Security token used to sign the requests and verify the server responses.
Method Detail

fetchItemsStatus

public void fetchItemsStatus()
Sends a request to fetch the status of the Unlock items. The result will be delivered asynchronously to the registered listener.


onAsyncRequestComplete

public void onAsyncRequestComplete(AsyncRequest requestTask)
Specified by:
onAsyncRequestComplete in interface AsyncRequest.AsyncRequestResultListener

onSPUnlockRequestError

public void onSPUnlockRequestError(AbstractResponse response)
Implemented from SPUnlockResponseListener. Forwards the call to the user listener.

Specified by:
onSPUnlockRequestError in interface SPUnlockResponseListener

onSPUnlockItemsStatusResponseReceived

public void onSPUnlockItemsStatusResponseReceived(UnlockedItemsResponse response)
Implemented from SPUnlockResponseListener. Forwards the call to the user listener.

Specified by:
onSPUnlockItemsStatusResponseReceived in interface SPUnlockResponseListener