Refactor the smarts into the api classes.
The object classes are now simple wrappers. Improve parameter testing, by passing foo="bar" where possible.
This commit is contained in:
parent
7a7b43afc7
commit
86ba0914c8
18 changed files with 307 additions and 316 deletions
|
@ -1,12 +1,6 @@
|
|||
"""
|
||||
Representation of a Tag object
|
||||
"""
|
||||
try:
|
||||
from urllib.parse import quote # Python3
|
||||
except ImportError:
|
||||
from urllib import quote # Python2
|
||||
|
||||
from trovebox.errors import TroveboxError
|
||||
from .trovebox_object import TroveboxObject
|
||||
|
||||
class Tag(TroveboxObject):
|
||||
|
@ -21,10 +15,7 @@ class Tag(TroveboxObject):
|
|||
Returns True if successful.
|
||||
Raises a TroveboxError if not.
|
||||
"""
|
||||
result = self._client.post("/tag/%s/delete.json" %
|
||||
quote(self.id), **kwds)["result"]
|
||||
if not result:
|
||||
raise TroveboxError("Delete response returned False")
|
||||
result = self._client.tag.delete(self, **kwds)
|
||||
self._delete_fields()
|
||||
return result
|
||||
|
||||
|
@ -35,8 +26,7 @@ class Tag(TroveboxObject):
|
|||
Updates this tag with the specified parameters.
|
||||
Returns the updated tag object.
|
||||
"""
|
||||
result = self._client.post("/tag/%s/update.json" % quote(self.id),
|
||||
**kwds)["result"]
|
||||
self._replace_fields(result)
|
||||
result = self._client.tag.update(self, **kwds)
|
||||
self._replace_fields(result.get_fields())
|
||||
|
||||
# def view(self, **kwds):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue