Updated docstrings

This commit is contained in:
sneakypete81 2013-09-07 11:19:15 +01:00
parent 7afb709531
commit adecf7aad0
2 changed files with 32 additions and 7 deletions

View file

@ -8,7 +8,11 @@ from .api_base import ApiBase
class ApiTags(ApiBase): class ApiTags(ApiBase):
""" Definitions of /tags/ API endpoints """ """ Definitions of /tags/ API endpoints """
def list(self, **kwds): 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 = self._client.get("/tags/list.json", **kwds)["result"]
tags = http.result_to_list(tags) tags = http.result_to_list(tags)
return [Tag(self._client, tag) for tag in tags] return [Tag(self._client, tag) for tag in tags]
@ -17,14 +21,19 @@ class ApiTag(ApiBase):
""" Definitions of /tag/ API endpoints """ """ Definitions of /tag/ API endpoints """
def create(self, tag, **kwds): def create(self, tag, **kwds):
""" """
Create a new tag. Endpoint: /tag/create.json
The API returns true if the tag was sucessfully created
Creates a new tag.
Returns True if successful.
Raises a TroveboxError if not.
""" """
return self._client.post("/tag/create.json", tag=tag, **kwds)["result"] return self._client.post("/tag/create.json", tag=tag, **kwds)["result"]
def delete(self, tag, **kwds): def delete(self, tag, **kwds):
""" """
Delete a tag. Endpoint: /tag/<id>/delete.json
Deletes a tag.
Returns True if successful. Returns True if successful.
Raises a TroveboxError if not. Raises a TroveboxError if not.
""" """
@ -33,8 +42,15 @@ class ApiTag(ApiBase):
return tag.delete(**kwds) return tag.delete(**kwds)
def update(self, tag, **kwds): def update(self, tag, **kwds):
""" Update a tag """ """
Endpoint: /tag/<id>/update.json
Updates a tag with the specified parameters.
Returns the updated tag object.
"""
if not isinstance(tag, Tag): if not isinstance(tag, Tag):
tag = Tag(self._client, {"id": tag}) tag = Tag(self._client, {"id": tag})
tag.update(**kwds) tag.update(**kwds)
return tag return tag
# def view(self, tag, **kwds):

View file

@ -13,7 +13,9 @@ class Tag(TroveboxObject):
""" Representation of a Tag object """ """ Representation of a Tag object """
def delete(self, **kwds): def delete(self, **kwds):
""" """
Delete this tag. Endpoint: /tag/<id>/delete.json
Deletes this tag.
Returns True if successful. Returns True if successful.
Raises a TroveboxError if not. Raises a TroveboxError if not.
""" """
@ -25,7 +27,14 @@ class Tag(TroveboxObject):
return result return result
def update(self, **kwds): def update(self, **kwds):
""" Update this tag with the specified parameters """ """
Endpoint: /tag/<id>/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), result = self._trovebox.post("/tag/%s/update.json" % quote(self.id),
**kwds)["result"] **kwds)["result"]
self._replace_fields(result) self._replace_fields(result)
# def view(self, **kwds):