Add get_or_create_draft() to the API

Review Request #4184 — Created May 28, 2013 and submitted — Latest diff uploaded

Information

RBTools
master

Reviewers

Add get_or_create_draft() to the API.

A new resource specific method for ReviewRequestResource has been
added to allow creating/retreival of a Review Request Draft resource
without uploading a diff.

Creating a Review Request Draft is accomplished by making a POST
request to the draft url, or uploading a diff. The API usually
requires retrieving a resource by GET before create() can be called to
POST to the url. Since draft resources cannot be accessed before they
are created, the new get_or_create_draft() method allows making the
POST request from the ReviewRequestResource without first accessing
the draft.
Retrieved and updated draft resources using a Python shell under the following conditions:
 - get_or_create_draft() with no draft existing: Draft created and returned
 - get_or_create_draft() with existing draft: Draft returned and unchanged
 - get_or_create_draft(summary="new") with no draft exisitng: Draft created, returned, and draft summary updated to "new"
 - get_or_create_draft(summary="new") with existing draft: Draft returned and draft summary updated to "new"