From 02649f592f7a91cb9ac4248e158b26e7df680598 Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Tue, 2 Feb 2016 16:17:40 -0800 Subject: [PATCH] Closes #1 --- staffjoy/resources/role.py | 10 ---------- staffjoy/resources/timeclock.py | 2 +- staffjoy/resources/worker.py | 10 ++++++++++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/staffjoy/resources/role.py b/staffjoy/resources/role.py index ef607c7..1cf1c43 100644 --- a/staffjoy/resources/role.py +++ b/staffjoy/resources/role.py @@ -1,7 +1,6 @@ from ..resource import Resource from .worker import Worker from .schedule import Schedule -from .timeclock import Timeclock class Role(Resource): @@ -22,12 +21,3 @@ def get_schedules(self, **kwargs): def get_schedule(self, id): return Schedule.get(parent=self, id=id) - - def get_timeclocks(self, **kwargs): - return Timeclock.get_all(parent=self, **kwargs) - - def get_timeclock(self, id): - return Timeclock.get(parent=self, id=id) - - def create_timeclock(self, **kwargs): - return Timeclock.create(parent=self, **kwargs) diff --git a/staffjoy/resources/timeclock.py b/staffjoy/resources/timeclock.py index 4aab502..e93aae7 100644 --- a/staffjoy/resources/timeclock.py +++ b/staffjoy/resources/timeclock.py @@ -2,5 +2,5 @@ class Timeclock(Resource): - PATH = "organizations/{organization_id}/locations/{location_id}/roles/{role_id}/timeclocks/{timeclock_id}" + PATH = "organizations/{organization_id}/locations/{location_id}/roles/{role_id}/users/{user_id}/timeclocks/{timeclock_id}" ID_NAME = "timeclock_id" diff --git a/staffjoy/resources/worker.py b/staffjoy/resources/worker.py index c60e823..d04caf8 100644 --- a/staffjoy/resources/worker.py +++ b/staffjoy/resources/worker.py @@ -1,7 +1,17 @@ from ..resource import Resource +from .timeclock import Timeclock class Worker(Resource): """Organization administrators""" PATH = "organizations/{organization_id}/locations/{location_id}/roles/{role_id}/users/{user_id}" ID_NAME = "user_id" + + def get_timeclocks(self, **kwargs): + return Timeclock.get_all(parent=self, **kwargs) + + def get_timeclock(self, id): + return Timeclock.get(parent=self, id=id) + + def create_timeclock(self, **kwargs): + return Timeclock.create(parent=self, **kwargs)