Class Controller
- java.lang.Object
-
- com.cheetahdigital.corekit.models.module.Controller
-
- All Implemented Interfaces:
RestController
- Direct Known Subclasses:
ActivitiesAPI,AuthenticationAPI,BadgesAPI,BeaconsAPI,ChallengesAPI,CodesAPI,ConnectionsAPI,ContentPagesAPI,ContentTokenAPI,EventsAPI,FeedbackAPI,FriendsAPI,GiftcardsAPI,GroupsAPI,HouseholdAPI,InfoAPI,LeaderboardAPI,MembersAPI,MessagesAPI,MetaReferencesAPI,NewsfeedAPI,OffersAPI,OrdersAPI,PaymentAPI,PlacesAPI,PreferencesAPI,ProductsAPI,ProfileAPI,PunchcardAPI,ReceiptAPI,ReferralAPI,RewardsAPI,StaticFilesAPI,SummaryAPI,TrackingAPI,TransactionsAPI,UpgradeCheckAPI
public class Controller extends java.lang.Object implements RestController
Base REST Controller for Loyalty Modules
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSTANDARD_DATE_FORMATstatic java.lang.StringTIMEZONE_DATE_FORMAT
-
Constructor Summary
Constructors Constructor Description Controller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description okhttp3.CachecreateCache()Method for creating a cached file used to stored temporary data for requestsprotected okhttp3.OkHttpClientcreateHttpClient()protected <T> TcreateRetrofitInterface(java.lang.Class<T> classInterface)voidevictAllCache()Method for removing/evicting all the Cache, ideally called during Logout Make sure that a call toinitialize()was properly made first before calling this method.protected com.google.gson.GsongetGsonConfiguration()protected retrofit2.RetrofitgetRestAdapter()protected intgetTimeoutConnectionInSeconds()protected intgetTimeoutSocketInSeconds()voidinitialize()Initialize the controllervoidremoveResponsesFromCache(java.lang.String path)Removes cached responses which contains the specified path.
-
-
-
Field Detail
-
STANDARD_DATE_FORMAT
public static final java.lang.String STANDARD_DATE_FORMAT
- See Also:
- Constant Field Values
-
TIMEZONE_DATE_FORMAT
public static final java.lang.String TIMEZONE_DATE_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize()
Initialize the controller
-
createHttpClient
protected okhttp3.OkHttpClient createHttpClient()
- Returns:
- instance of
OkHttpClientwith default configurations
-
getTimeoutConnectionInSeconds
protected int getTimeoutConnectionInSeconds()
- Returns:
- timeout connection. default value is 60 seconds
-
getTimeoutSocketInSeconds
protected int getTimeoutSocketInSeconds()
- Returns:
- timeout connection. default value is 60 seconds
-
getGsonConfiguration
protected com.google.gson.Gson getGsonConfiguration()
- Returns:
- instance of
Gsonwith configuration found inControllerConfig
-
getRestAdapter
protected retrofit2.Retrofit getRestAdapter()
- Returns:
- instance of
Retrofitwith configuration found inSdkConfig
-
createRetrofitInterface
protected <T> T createRetrofitInterface(java.lang.Class<T> classInterface)
- Type Parameters:
T- class interface type- Parameters:
classInterface- class used to create implementation of API endpoints- Returns:
- the current interface generated via
Retrofit.create(Class)
-
createCache
public okhttp3.Cache createCache()
Description copied from interface:RestControllerMethod for creating a cached file used to stored temporary data for requests- Specified by:
createCachein interfaceRestController- Returns:
- new
Cachefor caching requests
-
evictAllCache
public void evictAllCache()
Description copied from interface:RestControllerMethod for removing/evicting all the Cache, ideally called during Logout Make sure that a call toinitialize()was properly made first before calling this method.- Specified by:
evictAllCachein interfaceRestController
-
removeResponsesFromCache
public void removeResponsesFromCache(java.lang.String path)
Description copied from interface:RestControllerRemoves cached responses which contains the specified path. Make sure that a call toinitialize()was properly made first before calling this method.- Specified by:
removeResponsesFromCachein interfaceRestController- Parameters:
path- the path that will be used to search the cached data.
-
-