From d38f626bf84fcca844af3c1a28157c5841284cac Mon Sep 17 00:00:00 2001 From: Steven Rossiter Date: Thu, 29 Dec 2016 16:20:12 +0000 Subject: [PATCH] Update to areas.Task methods Adds a `find` method on the `Task` area to retrieve a single task by the id. This has been named `Task.find` to remain consistent with other areas. The `get` method is not consistent with other areas though which use `find_all` or `find_all_by_*`. So `find_all` has been added and a comment placed in `get` to deprecate this method. --- pypodio2/areas.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pypodio2/areas.py b/pypodio2/areas.py index 7eb9aec..4795afc 100644 --- a/pypodio2/areas.py +++ b/pypodio2/areas.py @@ -244,11 +244,27 @@ def get(self, **kwargs): """ Get tasks endpoint. QueryStrings are kwargs """ + # should deprecate this method return self.transport.GET('/task/', **kwargs) + def find_all(self, **kwargs): + """ + Get all tasks. QueryStrings are kwargs + """ + return self.transport.GET('/task/', **kwargs) + + def find(self, task_id, **kwargs): + """ + Get the task with the given task_id. + + :param task_id: Task ID + :type task_id: str or int + """ + return self.transport.GET(url='/task/%s' % task_id) + def delete(self, task_id): """ - Deletes the app with the given id. + Deletes the task with the given id. :param task_id: Task ID :type task_id: str or int