DoSomething/ds-mdata-responder — pull request #122 by jonuy (2014-08-22 23:28:01+00:00)
Title: Create SMS MP game from mobile

#### What's this PR do?
This allows for an SMS MP game to be created from text messages alone. The flow will allow for games to be created with anywhere between 1 to 3 betas invited.

#### Where should the reviewer start?
**app/config/competitive-stories.json**
This sets the opt-in paths that'll guide a user through creating a game on mobile.

**app/router.js**
Adds the endpoint that the game creation will happen through: `/sms-multiplayer-game/mobile-create`

**app/lib/userMessageHelpers.js**
Helper functions for dealing with user messages.

**app/models/sgGameCreateConfig.js**
Model for tracking state through the game creation process.

**app/controllers/SGCreateFromMobileController.js**
Most of the magic happens here. The two possible valid responses for a user is either a phone number or "Y" if they just want to start the game. If it's a phone number, we add it to the sgGameCreateConfig model as one of the betas to invite. If it's "Y", then we'll create the game with whatever we've got. Once all betas are received, we'll automatically create the game and also delete the sgGameCreateConfig document that was used for creating the game.

#### How should this be manually tested?
1. POST to `/sms-multiplayer-game/mobile-create?story_type=competitive-story&story_id=100` with params -
phone: 15555550100
args: 5555550101
2. POST to `/sms-multiplayer-game/mobile-create?story_type=competitive-story&story_id=100` with params -
phone: 15555550100
args: 5555550102
3. POST to `/sms-multiplayer-game/mobile-create?story_type=competitive-story&story_id=100` with params -
phone: 15555550100
args: 5555550103
4. Verify a game document has been created in the sg_competitivestory_games collection.

#### What are the relevant tickets?
SMS-26

#### Notes:
* Game creation currently is not allowed by the `/sms-multiplayer-game/create` endpoint if there are less than 3 beta numbers.
* Automated testing for this flow is also coming soon.

cc: @tongxiang @DeeZone