Skip to content

Instantly share code, notes, and snippets.

@ThanawatMas
Last active December 2, 2018 17:19
Show Gist options
  • Save ThanawatMas/75f189a7d94f548c12f1a1138405101a to your computer and use it in GitHub Desktop.
Save ThanawatMas/75f189a7d94f548c12f1a1138405101a to your computer and use it in GitHub Desktop.
public class UserProfile implements Api {
private String id;
private String name;
private int level;
private long userExp;
private long expToNextLevel;
private String currentCategory;
public static Observable<Api> mockApi() {
return Observable.just(getUserFromSession("mocking"));
}
private static final UserProfile getUserFromSession(String session) {
//MockData for demonstration instead of query from database
UserProfile userProfile = new UserProfile();
userProfile.setId("37403243922343");
userProfile.setName("MockUser");
userProfile.setLevel(54);
userProfile.setUserExp(200L);
userProfile.setExpToNextLevel(1000L);
userProfile.setCurrentCategory("Shoe");
return userProfile;
}
@Override
public String getApiName() {
return getClass().getSimpleName();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment