from collections import OrderedDict
from rest_framework import viewsets, mixins, response, reverse


NAME = 'vsemionov.boomerang.api'
VERSION = '0.5.18'


class ApiInfoViewSet(mixins.ListModelMixin,
                  viewsets.GenericViewSet):
    view_name = 'Api Info'

    @staticmethod
    def _get_user_url(request):
        return reverse.reverse('user-detail', request=request, args=[request.user.username])

    def get_view_name(self):
        return self.view_name

    def list(self, request, *args, **kwargs):
        app = OrderedDict((('name', NAME),
                           ('version', VERSION)))
        user = OrderedDict((('username', request.user.username),
                            ('url', self._get_user_url(request)))) \
            if request.user.id else None
        info = OrderedDict((('app', app),
                            ('user', user)))
        return response.Response(info)

@@ -147,9 +147,9 @@
 .5.1
-8
+9
 '%0A%0A%0A

version 0.5.19