Ahenk/opt/ahenk/base/model/Task.py

31 lines
688 B
Python
Raw Normal View History

2016-03-02 11:33:48 +02:00
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
2016-03-07 17:13:03 +02:00
import json
2016-03-02 11:33:48 +02:00
class Task(object):
"""docstring for Task"""
def __init__(self,message):
2016-03-07 17:13:03 +02:00
self.payload = json.loads(message)
2016-03-14 17:16:26 +02:00
self.request = self.payload['request']
2016-03-02 11:33:48 +02:00
2016-03-07 17:13:03 +02:00
@property
2016-03-14 10:55:28 +02:00
def task_id(self):
2016-03-14 17:19:05 +02:00
self.request['id']
2016-03-14 10:55:28 +02:00
@property
def plugin_name(self):
2016-03-14 17:16:26 +02:00
self.request['pluginName']
2016-03-02 11:33:48 +02:00
2016-03-07 17:13:03 +02:00
@property
2016-03-14 10:55:28 +02:00
def command_id(self):
2016-03-14 17:16:26 +02:00
self.request['commandId']
2016-03-07 17:13:03 +02:00
@property
def params(self):
2016-03-14 17:16:26 +02:00
self.request['parameterMap']
2016-03-07 17:13:03 +02:00
@property
2016-03-14 10:55:28 +02:00
def plugin_version(self):
2016-03-14 17:16:26 +02:00
self.request['pluginVersion']