mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-10 02:55:27 +02:00
First Refactoring
- Major API Changes in Core Module - Will be changed further. Still work in progress
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import json
|
||||
from flask_classy import FlaskView, route
|
||||
from modules.core.core import cbpi
|
||||
|
||||
class ActionView(FlaskView):
|
||||
|
||||
@route('/<action>', methods=['POST'])
|
||||
def action(self, action):
|
||||
"""
|
||||
Call global action button
|
||||
---
|
||||
tags:
|
||||
- action
|
||||
responses:
|
||||
200:
|
||||
description: action invoked
|
||||
"""
|
||||
print self.cbpi.cache["actions"]
|
||||
self.cbpi.cache["actions"][action]["function"](self.cbpi)
|
||||
|
||||
return ('',204)
|
||||
|
||||
@cbpi.addon.core.initializer()
|
||||
def init(cbpi):
|
||||
"""
|
||||
Initializer for the message module
|
||||
:param app: the flask app
|
||||
:return: None
|
||||
"""
|
||||
ActionView.cbpi = cbpi
|
||||
ActionView.register(cbpi._app, route_base='/api/action')
|
||||
Reference in New Issue
Block a user