endpoint versions
This commit is contained in:
parent
9fa96c3d3b
commit
f8e6020be6
|
@ -12,6 +12,7 @@ from ereuse_devicehub.resources import action, agent, deliverynote, inventory, \
|
|||
from ereuse_devicehub.resources.device import definitions
|
||||
from ereuse_devicehub.resources.documents import documents
|
||||
from ereuse_devicehub.resources.enums import PriceSoftware
|
||||
from ereuse_devicehub.resources.versions import versions
|
||||
|
||||
|
||||
class DevicehubConfig(Config):
|
||||
|
@ -24,7 +25,8 @@ class DevicehubConfig(Config):
|
|||
import_resource(deliverynote),
|
||||
import_resource(proof),
|
||||
import_resource(documents),
|
||||
import_resource(inventory)),
|
||||
import_resource(inventory),
|
||||
import_resource(versions)),
|
||||
)
|
||||
PASSWORD_SCHEMES = {'pbkdf2_sha256'} # type: Set[str]
|
||||
SQLALCHEMY_DATABASE_URI = 'postgresql://dhub:ereuse@localhost/devicehub' # type: str
|
||||
|
|
0
ereuse_devicehub/resources/versions/__init__.py
Normal file
0
ereuse_devicehub/resources/versions/__init__.py
Normal file
35
ereuse_devicehub/resources/versions/versions.py
Normal file
35
ereuse_devicehub/resources/versions/versions.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
import flask
|
||||
import teal.marshmallow
|
||||
import ereuse_utils
|
||||
|
||||
from typing import Callable, Iterable, Tuple
|
||||
from flask import make_response, g
|
||||
from teal.resource import Resource
|
||||
|
||||
|
||||
class VersionDef(Resource):
|
||||
__type__ = 'Version'
|
||||
SCHEMA = None
|
||||
VIEW = None # We do not want to create default / documents endpoint
|
||||
AUTH = False
|
||||
|
||||
def __init__(self, app,
|
||||
import_name=__name__,
|
||||
static_url_path=None,
|
||||
url_prefix=None,
|
||||
subdomain=None,
|
||||
url_defaults=None,
|
||||
root_path=None,
|
||||
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple()):
|
||||
|
||||
super().__init__(app, import_name, static_url_path,
|
||||
url_prefix, subdomain, url_defaults, root_path, cli_commands)
|
||||
d = {'id': None}
|
||||
get = {'GET'}
|
||||
|
||||
self.add_url_rule('/', defaults=d, view_func=self.view, methods=get)
|
||||
|
||||
def view(self):
|
||||
#import pdb; pdb.set_trace()
|
||||
v = "{}".format(ereuse_utils.version('ereuse-devicehub'))
|
||||
return {'devicehub': v}
|
4
setup.py
4
setup.py
|
@ -9,10 +9,10 @@ test_requires = [
|
|||
|
||||
setup(
|
||||
name='ereuse-devicehub',
|
||||
version='1.0a1',
|
||||
version='0.1.0a1',
|
||||
url='https://github.com/ereuse/devicehub-teal',
|
||||
project_urls={
|
||||
'Documentation': 'http://devicheub.ereuse.org',
|
||||
'Documentation': 'http://devicehub.ereuse.org',
|
||||
'Code': 'http://github.com/ereuse/devicehub-teal',
|
||||
'Issue tracker': 'https://tree.taiga.io/project/ereuseorg-devicehub/issues?q=rules'
|
||||
},
|
||||
|
|
Reference in a new issue