public class GameSummary
extends java.lang.Object
One GameSummary instance corresponds to one object from the games array in the response from the server's /games endpoint.
Constructor and Description |
---|
GameSummary(com.google.gson.JsonObject infoFromServer)
Creates a game summary from JSON from the server.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getId()
Gets the unique, server-assigned ID of this game.
|
java.lang.String |
getMode()
Gets the mode of this game, either area or target.
|
java.lang.String |
getOwner()
Gets the owner/creator of this game.
|
java.lang.String |
getPlayerRole(java.lang.String userEmail,
android.content.Context context)
Gets the name of the user's team/role.
|
boolean |
isInvitation(java.lang.String userEmail)
Determines whether this game is an invitation to the user.
|
boolean |
isOngoing(java.lang.String userEmail)
Determines whether the user is currently involved in this game.
|
public GameSummary(com.google.gson.JsonObject infoFromServer)
infoFromServer
- one object from the array in the /games responsepublic java.lang.String getId()
public java.lang.String getMode()
public java.lang.String getOwner()
public java.lang.String getPlayerRole(java.lang.String userEmail, android.content.Context context)
userEmail
- the logged-in user's emailcontext
- an Android context (for access to resources)public boolean isInvitation(java.lang.String userEmail)
userEmail
- the logged-in user's emailpublic boolean isOngoing(java.lang.String userEmail)
For a game to be ongoing, it must not be over and the user must have accepted their invitation to it.
userEmail
- the logged-in user's email