forked from opalstack/opalstack-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusage.py
More file actions
26 lines (20 loc) · 908 Bytes
/
usage.py
File metadata and controls
26 lines (20 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from .manager import ApiModelManager
class UsageManager(ApiModelManager):
def __init__(self, api):
self.model_name = 'usage'
self.model_name_plural = 'usages'
self.is_instantaneous = True
self.primary_key = None
super().__init__(api)
def webusage_latest(self, embed=[]):
qs = ('?embed=' + ','.join(embed)) if embed else ''
return self.api.http_get_result(f'/{self.model_name}/web/latest/{qs}', ensure_status=[200])
def mailusage_latest(self, embed=[]):
qs = ('?embed=' + ','.join(embed)) if embed else ''
return self.api.http_get_result(f'/{self.model_name}/mail/latest/{qs}', ensure_status=[200])
def check_equals(self, a, b):
return ( a['id'] == b['id'] )
def check_obstructs(self, existing, new):
return False
def check_satisfies(self, existing, new):
return False