diff --git a/src/AppBundle/Controller/PublicApi20Controller.php b/src/AppBundle/Controller/PublicApi20Controller.php index 7b33748f..61bf8c88 100755 --- a/src/AppBundle/Controller/PublicApi20Controller.php +++ b/src/AppBundle/Controller/PublicApi20Controller.php @@ -540,4 +540,23 @@ public function mwlAction(Request $request) return $this->entityManager->getRepository('AppBundle:Mwl')->findAll(); }, $request); } + + /** + * Get all Ruling data + */ + public function rulingsAction(Request $request) + { + $rulings = $this->entityManager->getRepository('AppBundle:Ruling')->findAll(); + + $out = []; + foreach($rulings as $r) { + array_push($out, [ + 'title' => $r->getCard()->getTitle(), + 'ruling' => str_replace('\r', '', $r->getRawText()), + 'date_update' => date_format($r->getDateUpdate(), 'Y-m-d'), + 'nsg_rules_team_verified' => $r->getNsgRulesTeamVerified() + ]); + } + return $this->prepareResponseFromCache($out, count($out), new DateTime(), $request); + } } diff --git a/src/AppBundle/Resources/config/routing.yml b/src/AppBundle/Resources/config/routing.yml index b4a6e246..2ea2df67 100755 --- a/src/AppBundle/Resources/config/routing.yml +++ b/src/AppBundle/Resources/config/routing.yml @@ -685,6 +685,12 @@ api_public_mwl: defaults: _controller: AppBundle:PublicApi20:mwl +api_public_rulings: + path: /api/2.0/public/rulings + methods: [GET] + defaults: + _controller: AppBundle:PublicApi20:rulings + api_private_decks: path: /api/2.0/private/decks methods: [GET]