Skip to content

Commit

Permalink
adding unit_conversion as plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulworld committed Jul 3, 2018
1 parent 160cae7 commit 7312518
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 1 deletion.
Binary file modified istsos/__pycache__/application.cpython-36.pyc
Binary file not shown.
14 changes: 13 additions & 1 deletion istsos/application.py
Expand Up @@ -227,7 +227,19 @@ def get_current_requests(self):
return self.instance.requests


PLUGIN_API = {}
PLUGIN_API = {

#UNIT CONVERSION using Postgresql-unit
"UNIT_CONVERSION": (
'units.unitConversion',
'UnitConversion'
),
#UNIT CONVERSION using pint
"UNIT_CONVERSION_PINT": (
'units.unit_conversion_pint',
'UnitConversionPint'
)
}

REST_API = {

Expand Down
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions istsos/plugins/unit_conversion/action.py
@@ -0,0 +1,21 @@
import asyncio
from istsos.entity.rest.response import Response
from istsos.actions.action import CompositeAction


class PingApi(CompositeAction):

@asyncio.coroutine
def before(self, request):
json = request.get_json()
if 'message' in json:
request['message'] = json['message']
yield from self.add_plugin("unit_conversion", "UnitConversionPost")

@asyncio.coroutine
def after(self, request):
request['response'] = Response(
json_source=Response.get_template({
"message": request["message"]
})
)
15 changes: 15 additions & 0 deletions istsos/plugins/unit_conversion/config.json
@@ -0,0 +1,15 @@
{
"name": "unit_conversion",
"version": "1.0.0",
"author": "rahulworld",
"author_email": "rahulnitsxr@gmail.com",
"description": "This is an istSOS3 plugin",
"license": "GPL3",
"url": "http://example.com/unit_conversion/",
"img": "http://example.com/unit_conversion/logo.png",
"api": {
"UNIT_CON_POST": [
"unit_conversion.action", "UNIT_CON_POSTApi"
]
}
}

0 comments on commit 7312518

Please sign in to comment.