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.String
STANDARD_DATE_FORMAT
static java.lang.String
TIMEZONE_DATE_FORMAT
-
Constructor Summary
Constructors Constructor Description Controller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description okhttp3.Cache
createCache()
Method for creating a cached file used to stored temporary data for requestsprotected okhttp3.OkHttpClient
createHttpClient()
protected <T> T
createRetrofitInterface(java.lang.Class<T> classInterface)
void
evictAllCache()
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.Gson
getGsonConfiguration()
protected retrofit2.Retrofit
getRestAdapter()
protected int
getTimeoutConnectionInSeconds()
protected int
getTimeoutSocketInSeconds()
void
initialize()
Initialize the controllervoid
removeResponsesFromCache(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
OkHttpClient
with 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
Gson
with configuration found inControllerConfig
-
getRestAdapter
protected retrofit2.Retrofit getRestAdapter()
- Returns:
- instance of
Retrofit
with 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:RestController
Method for creating a cached file used to stored temporary data for requests- Specified by:
createCache
in interfaceRestController
- Returns:
- new
Cache
for caching requests
-
evictAllCache
public void evictAllCache()
Description copied from interface:RestController
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.- Specified by:
evictAllCache
in interfaceRestController
-
removeResponsesFromCache
public void removeResponsesFromCache(java.lang.String path)
Description copied from interface:RestController
Removes cached responses which contains the specified path. Make sure that a call toinitialize()
was properly made first before calling this method.- Specified by:
removeResponsesFromCache
in interfaceRestController
- Parameters:
path
- the path that will be used to search the cached data.
-
-