Browse Source

updated content-type. fixes #7

master
Julio Biason 11 years ago
parent
commit
16da4d0b4a
  1. 2
      doc/client/flow/voting.rst
  2. 4
      doc/client/index.rst
  3. 12
      luncho/blueprints/groups.py
  4. 2
      luncho/blueprints/places.py
  5. 6
      luncho/blueprints/token.py
  6. 8
      luncho/blueprints/users.py
  7. 10
      luncho/blueprints/voting.py
  8. 20
      luncho/exceptions.py

2
doc/client/flow/voting.rst

@ -19,7 +19,7 @@ A typical voting/check results flow would be:
.. sourcecode:: http
HTTP/1.1 404 Not Found
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR",
"code": "UserNotFound",

4
doc/client/index.rst

@ -23,7 +23,7 @@ The response will always be:
.. sourcecode:: http
HTTP/1.1 400 Bad Request
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "Request MUST be in JSON format" }
@ -33,7 +33,7 @@ If instead you do a proper JSON request with:
POST /randomendpoint
Host: example.com
Content-type: text/json
Content-type: application/json
{ "field1": "value", "field2": "value" }

12
luncho/blueprints/groups.py

@ -47,7 +47,7 @@ def user_groups():
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK", "groups": [ { "id": "<group id>" ,
"name": "<group name>",
@ -93,7 +93,7 @@ def create_group():
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK", "id": <new group id> }
@ -248,7 +248,7 @@ def add_users_to_group(group_id):
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK", "not_found": [<user>, <user>, ...] }
@ -301,7 +301,7 @@ def list_group_members(group_id):
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK", "users": [ { "username": "<username>",
"full_name": "<full name>"},
@ -356,7 +356,7 @@ def get_group_places(group_id):
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK", "places": [ { "id": "<place id>",
"name": "<place name>"},
@ -408,7 +408,7 @@ def group_add_places(group_id):
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK",
"rejected": [<place>, <place>, ...],

2
luncho/blueprints/places.py

@ -77,7 +77,7 @@ def get_places():
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK", "places": [ { "id": "<placeId>",
"name": "<place name>",

6
luncho/blueprints/token.py

@ -24,7 +24,7 @@ class UserDoesNotExistException(LunchoException):
.. sourcecode:: http
HTTP/1.1 404 Not found
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "User does not exist" }
"""
@ -40,7 +40,7 @@ class InvalidPasswordException(LunchoException):
.. sourcecode:: http
HTTP/1.1 401 Unauthorized
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "Invalid password" }
"""
@ -74,7 +74,7 @@ def get_token():
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK", "token": "access_token" }

8
luncho/blueprints/users.py

@ -30,7 +30,7 @@ class UsernameAlreadyExistsException(LunchoException):
..sourcecode:: http
HTTP/1.1 409 Conflict
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "Username already exists" }
"""
@ -58,7 +58,7 @@ def create_user():
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK" }
@ -109,7 +109,7 @@ def update_user():
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK" }
@ -148,7 +148,7 @@ def delete_user():
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: text/json
Content-Type: application/json
{ "status": "OK" }

10
luncho/blueprints/voting.py

@ -39,7 +39,7 @@ class VoteAlreadyCastException(LunchoException):
.. sourcecode:: http
HTTP/1.1 406 Not Acceptable
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "User already voted today" }
"""
@ -54,7 +54,7 @@ class InvalidNumberOfPlacesCastedException(LunchoException):
.. sourcecode:: http
HTTP/1.1 406 Not Acceptable
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR",
"message": "The vote must register {places} places" }
@ -71,7 +71,7 @@ class PlaceDoesntBelongToGroupException(LunchoException):
.. sourcecode:: http
http/1.1 404 Not Found
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR",
"message": "Places are not part of this group",
@ -94,7 +94,7 @@ class PlacesVotedMoreThanOnceException(LunchoException):
.. sourcecode:: http
HTTP/1.1 409 Conflict
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR",
"message": "Places voted more than once",
@ -208,7 +208,7 @@ def get_vote(group_id):
.. sourcecode:: http
HTTP/1.1 200 OK
Content-type: text/json
Content-type: application/json
{ "status": "OK",
"closed": <True if all members voted>,

20
luncho/exceptions.py

@ -36,7 +36,7 @@ class RequestMustBeJSONException(LunchoException):
..sourcecode:: http
HTTP/1.1 400 Bad Request
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "Request MUST be in JSON format" }
"""
@ -52,7 +52,7 @@ class MissingFieldsException(LunchoException):
..sourcecode:: http
HTTP/1.1 400 Bad Request
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR",
"message": "Missing fields",
@ -71,7 +71,7 @@ class InvalidTokenException(LunchoException):
..sourcecode:: http
HTTP/1.1 400 Bad Request
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "Invalid token" }
"""
@ -87,7 +87,7 @@ class UserNotFoundException(LunchoException):
..sourccode:: http
HTTP/1.1 404 Not Found
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "User not found (via token)" }
@ -104,7 +104,7 @@ class ElementNotFoundException(LunchoException):
..sourcecode:: http
HTTP/1.1 404 Not Found
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR", "message": "{element} not found" }
@ -122,7 +122,7 @@ class AuthorizationRequiredException(LunchoException):
..sourcecode:: http
HTTP/1.1 401 Unauthorized
Content-Type: text/json
Content-Type: application/json
{ "status": "ERROR": "message": "Request requires authentication" }
"""
@ -138,7 +138,7 @@ class AccountNotVerifiedException(LunchoException):
.. sourcecode:: http
HTTP/1.1 412 Precondition Failed
Content-Type: test/json
Content-Type: application/json
{ "status": "ERROR", "message": "Account not verified" }
"""
@ -154,7 +154,7 @@ class NewMaintainerDoesNotExistException(LunchoException):
.. sourcecode:: http
HTTP/1.1 404 Not found
Content-Type: test/json
Content-Type: application/json
{ "status": "ERROR", "message": "New admin not found" }
"""
@ -170,7 +170,7 @@ class UserIsNotAdminException(LunchoException):
.. sourcecode:: http
HTTP/1.1 403 Forbidden
Content-Type: test/json
Content-Type: application/json
{ "status": "ERROR", "message": "User is not admin" }
"""
@ -186,7 +186,7 @@ class UserIsNotMemberException(LunchoException):
.. sourcecode:: http
HTTP/1.1 403 Forbidden
Content-Type: test/json
Content-Type: application/json
{ "status": "ERROR", "message": "User is not member of this group" }
"""

Loading…
Cancel
Save