From adecf7aad0df262450a2f4d17d10798aaffc2d8f Mon Sep 17 00:00:00 2001 From: sneakypete81 Date: Sat, 7 Sep 2013 11:19:15 +0100 Subject: [PATCH] Updated docstrings --- trovebox/api/api_tag.py | 26 +++++++++++++++++++++----- trovebox/objects/tag.py | 13 +++++++++++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/trovebox/api/api_tag.py b/trovebox/api/api_tag.py index dd11b15..fbab095 100644 --- a/trovebox/api/api_tag.py +++ b/trovebox/api/api_tag.py @@ -8,7 +8,11 @@ from .api_base import ApiBase class ApiTags(ApiBase): """ Definitions of /tags/ API endpoints """ def list(self, **kwds): - """ Returns a list of Tag objects """ + """ + Endpoint: /tags/list.json + + Returns a list of Tag objects. + """ tags = self._client.get("/tags/list.json", **kwds)["result"] tags = http.result_to_list(tags) return [Tag(self._client, tag) for tag in tags] @@ -17,14 +21,19 @@ class ApiTag(ApiBase): """ Definitions of /tag/ API endpoints """ def create(self, tag, **kwds): """ - Create a new tag. - The API returns true if the tag was sucessfully created + Endpoint: /tag/create.json + + Creates a new tag. + Returns True if successful. + Raises a TroveboxError if not. """ return self._client.post("/tag/create.json", tag=tag, **kwds)["result"] def delete(self, tag, **kwds): """ - Delete a tag. + Endpoint: /tag//delete.json + + Deletes a tag. Returns True if successful. Raises a TroveboxError if not. """ @@ -33,8 +42,15 @@ class ApiTag(ApiBase): return tag.delete(**kwds) def update(self, tag, **kwds): - """ Update a tag """ + """ + Endpoint: /tag//update.json + + Updates a tag with the specified parameters. + Returns the updated tag object. + """ if not isinstance(tag, Tag): tag = Tag(self._client, {"id": tag}) tag.update(**kwds) return tag + + # def view(self, tag, **kwds): diff --git a/trovebox/objects/tag.py b/trovebox/objects/tag.py index 94d5ac4..5c9b905 100644 --- a/trovebox/objects/tag.py +++ b/trovebox/objects/tag.py @@ -13,7 +13,9 @@ class Tag(TroveboxObject): """ Representation of a Tag object """ def delete(self, **kwds): """ - Delete this tag. + Endpoint: /tag//delete.json + + Deletes this tag. Returns True if successful. Raises a TroveboxError if not. """ @@ -25,7 +27,14 @@ class Tag(TroveboxObject): return result def update(self, **kwds): - """ Update this tag with the specified parameters """ + """ + Endpoint: /tag//update.json + + Updates this tag with the specified parameters. + Returns the updated tag object. + """ result = self._trovebox.post("/tag/%s/update.json" % quote(self.id), **kwds)["result"] self._replace_fields(result) + + # def view(self, **kwds):