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

64 lines
1.2 KiB
Python
Raw Normal View History

2016-03-16 17:26:25 +02:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
import json
from base.model.Plugin import Plugin
2016-03-16 17:26:25 +02:00
class Profile(object):
"""docstring for Profile"""
def __init__(self, message):
2016-03-16 17:26:25 +02:00
self.profile = message
@property
def id(self):
return self.profile['id']
@property
def create_date(self):
2016-03-24 17:55:23 +02:00
return self.profile['createDate']
@property
def modify_date(self):
2016-03-24 17:55:23 +02:00
return self.profile['modifyDate']
2016-03-16 17:26:25 +02:00
@property
def label(self):
return self.profile['label']
2016-03-16 17:26:25 +02:00
@property
def description(self):
return self.profile['description']
@property
def overridable(self):
return self.profile['overridable']
@property
def active(self):
return self.profile['active']
@property
def deleted(self):
return self.profile['deleted']
@property
def profile_data(self):
return self.profile['profileData']
2016-03-16 17:26:25 +02:00
@property
def plugin(self):
return Plugin(self.profile['plugin'])
def to_string(self):
return str(self.profile)
def to_json(self):
return json.load(self.profile)
2016-03-29 11:52:18 +03:00
@property
def obj_name(self):
return "PROFILE"