-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e14cb7
commit 24e507d
Showing
10 changed files
with
115 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Enable demo integration | ||
make demo-import | ||
|
||
# Start application | ||
make start | ||
|
||
# Create new player | ||
curl -X "POST" http://localhost:50080/api/players/ \ | ||
-d "{\"name\": \"Jane Doe\",\"username\":\"jane.doe\",\"email\": \"jane.doe@example.org\",\"image_url\":\"https://api.adorable.io/avatars/128/354\"}" | ||
|
||
# Perform demo action 5x | ||
curl -X "POST" http://localhost:50080/api/progress/ \ | ||
-d "{\"username\":\"jane.doe\",\"actions\":[\"demo-action\",\"demo-action\",\"demo-action\",\"demo-action\",\"demo-action\"]}" | ||
|
||
# Get player activity | ||
curl -X "GET" http://localhost:50080/api/players/jane.doe/personal-activities/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Enable demo integration | ||
make github-import | ||
|
||
# Start application | ||
make start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ integration: | |
actions: ~ | ||
achievements: ~ | ||
validators: ~ | ||
webhooks: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
integration: | ||
levels: | ||
actions: ~ | ||
achievements: ~ | ||
validators: ~ | ||
webhooks: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
namespace App\Api\EventListener; | ||
|
||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; | ||
use App\Api\Response\ResponseSerializer; | ||
|
||
class KernelExceptionListener | ||
{ | ||
public function __construct(ResponseSerializer $serializer) | ||
{ | ||
$this->serializer = $serializer; | ||
} | ||
|
||
public function onKernelException(GetResponseForExceptionEvent $event) | ||
{ | ||
$exception = $event->getException(); | ||
$response = $this->serializer->createResponse([ | ||
'exception' => get_class($exception), | ||
'message' => $exception->getMessage() | ||
]); | ||
|
||
if ($exception instanceof HttpExceptionInterface) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
$response->setStatusCode($exception->getStatusCode()); | ||
} else { | ||
$response->setStatusCode(500); | ||
} | ||
|
||
$event->setResponse($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set application json header