Restructure API client

Review Request #4021 — Created April 4, 2013 and submitted — Latest diff uploaded

Information

RBTools
master

Reviewers

Restructure API client.

Instead of wrapping everything and hiding resources inside of various
Transport objects, Resource objects are now returned to the user. The
Transport no longer serves as an all-wrapping, interface to and
between everything, super object, but as a simple interface to
the Review Board server.

Resource method calls which return HttpRequests are now decorated,
which serves as the new wrapping mechanism. The decorator captures
calls to these methods, and passes the internal method, and arguments,
off to the Transport to be executed. The new simpler Transport now
only provides a few core methods; primarily it needs to be able to
massage the provided arguments, call the method, and deal with the
returned HttpRequest in a suitable manner. This should make writing
a new Async Transport simple.

Now that proper Resource objects are returned, API users can rely on
checking class types using isinstance to differentiate between item
and list resources etc.

Additionally, dictionary or list fields returned from a resource use
standard class types, regardless of the transport used.

Also, the unit tests have been updated to test the new code, and are
much more sane (reaching into internals much less).
Ran the new unit tests (passed), ran a number of unchanged rbt commands
(including posting this request with 'rbt post'), and used my development
Review Bot instance to test the new code (Review Bot is a user of the api).
    Loading...