OSDN Git Service

API: fixes a few return codes for project snippets
authorSebastian Ziebell <sebastian.ziebell@asquera.de>
Wed, 13 Feb 2013 11:09:16 +0000 (12:09 +0100)
committerSebastian Ziebell <sebastian.ziebell@asquera.de>
Wed, 13 Feb 2013 11:09:16 +0000 (12:09 +0100)
commitfd01f3aacda1e7e1966489e7d9a31f89745cd509
treeb53e600584b1bcb1294771defc183790441da2c5
parent375caeefcfb2672c8fdce18cf6f35372729d0c43
API: fixes a few return codes for project snippets

When using project snippets via API the functions now provide status codes for
different situations other then only returning 404 error. If required parameters are missing,
e.g. `title` when creating a project snippet a 400 (Bad request) error is returned. The snippet
delete function now is idempotent and returns a 200 (Ok) regardless if the snippet with the
given id is available or not. Changing return codes of these functions has the advantage that
the 404 error is used only for resources, which are not available.

Tests added to check these status codes when handling project snippets.
lib/api/projects.rb
spec/requests/api/projects_spec.rb