com.shephertz.app42.paas.sdk.jme.game
Class RewardService

java.lang.Object
  extended by com.shephertz.app42.paas.sdk.jme.game.RewardService

public class RewardService
extends java.lang.Object

Define a Reward e.g. Sword, Energy etc. Is needed for Reward Points The Game service allows Game, User, Score and ScoreBoard Management on the Cloud. The service allows Game Developer to create a Game and then do in Game Scoring using the Score service. It also allows to maintain a Scoreboard across game sessions using the ScoreBoard service. One can query for average or highest score for user for a Game and highest and average score across users for a Game. It also gives ranking of the user against other users for a particular game. The Reward and RewardPoints allows the Game Developer to assign rewards to a user and redeem the rewards. E.g. One can give Swords or Energy etc. The services Game, Score, ScoreBoard, Reward, RewardPoints can be used in Conjunction for complete Game Scoring and Reward Management.

See Also:
Game, RewardPoint, Score, ScoreBoard

Constructor Summary
RewardService(java.lang.String apiKey, java.lang.String secretKey, java.lang.String baseURL)
          this is a constructor that takes
 
Method Summary
 Reward createReward(java.lang.String rewardName, java.lang.String rewardDescription)
          Creates Reward.
 Reward earnRewards(java.lang.String gameName, java.lang.String gameUserName, java.lang.String rewardName, double rewardPoints)
          Adds the reward points to an users account.
 java.util.Vector getAllRewards()
          Fetches all the Rewards
 java.util.Vector getAllRewards(java.lang.Integer max, java.lang.Integer offset)
          Fetches all the Rewards by paging.
 App42Response getAllRewardsCount()
          Fetches the count of all the Rewards
 Reward getGameRewardPointsForUser(java.lang.String gameName, java.lang.String userName)
          Fetches the reward points for a particular user
 Reward getRewardByName(java.lang.String rewardName)
          Retrieves the reward for the specified name
 Reward redeemRewards(java.lang.String gameName, java.lang.String gameUserName, java.lang.String rewardName, double rewardPoints)
          Deducts the reward points from the earned rewards by a user.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RewardService

public RewardService(java.lang.String apiKey,
                     java.lang.String secretKey,
                     java.lang.String baseURL)
this is a constructor that takes

Parameters:
apiKey -
secretKey -
baseURL -
Method Detail

createReward

public Reward createReward(java.lang.String rewardName,
                           java.lang.String rewardDescription)
                    throws App42Exception
Creates Reward. Reward can be Sword, Energy etc. When Reward Points have to be added the Reward name created using this method has to be specified.

Parameters:
rewardName - - The reward that has to be created
rewardDescription - - The description of the reward to be created
Returns:
Reward object containing the reward that has been created
Throws:
App42Exception

earnRewards

public Reward earnRewards(java.lang.String gameName,
                          java.lang.String gameUserName,
                          java.lang.String rewardName,
                          double rewardPoints)
                   throws App42Exception
Adds the reward points to an users account. Reward Points can be earned by the user which can be redeemed later.

Parameters:
gameName - - Name of the game for which reward points have to be added
gameUserName - - The user for whom reward points have to be added
rewardName - - The rewards for which reward points have to be added
rewardPoints - - The points that have to be added
Returns:
Reward object containing the reward points that has been added
Throws:
App42Exception

getAllRewards

public java.util.Vector getAllRewards()
                               throws App42Exception
Fetches all the Rewards

Returns:
List of Reward objects containing all the rewards of the App
Throws:
App42Exception

getAllRewards

public java.util.Vector getAllRewards(java.lang.Integer max,
                                      java.lang.Integer offset)
                               throws App42Exception
Fetches all the Rewards by paging.

Parameters:
max - - Maximum number of records to be fetched
offset - - From where the records are to be fetched
Returns:
List of Reward objects containing all the rewards of the App
Throws:
App42Exception

getAllRewardsCount

public App42Response getAllRewardsCount()
                                 throws App42Exception
Fetches the count of all the Rewards

Returns:
App42Response objects containing count of all the rewards of the App
Throws:
App42Exception

getGameRewardPointsForUser

public Reward getGameRewardPointsForUser(java.lang.String gameName,
                                         java.lang.String userName)
                                  throws App42Exception
Fetches the reward points for a particular user

Parameters:
gameName - - Name of the game for which reward points have to be fetched
userName - - The user for whom reward points have to be fetched
Returns:
Reward object containing the reward points for the specified user
Throws:
App42Exception

getRewardByName

public Reward getRewardByName(java.lang.String rewardName)
                       throws App42Exception
Retrieves the reward for the specified name

Parameters:
rewardName - - Name of the reward that has to be fetched
Returns:
Reward object containing the reward based on the rewardName
Throws:
App42Exception

redeemRewards

public Reward redeemRewards(java.lang.String gameName,
                            java.lang.String gameUserName,
                            java.lang.String rewardName,
                            double rewardPoints)
                     throws App42Exception
Deducts the reward points from the earned rewards by a user.

Parameters:
gameName - - Name of the game for which reward points have to be deducted
gameUserName - - The user for whom reward points have to be deducted
rewardName - - The rewards for which reward points have to be deducted
rewardPoints - - The points that have to be deducted
Returns:
Reward object containing the reward points that has been deducted
Throws:
App42Exception