예제 #1
0
파일: api.py 프로젝트: slapec/django-yaat
# coding: utf-8

from restify.api import Api

from yaat_examples.api.resources import ModelExampleResource, ModelComputedExampleResource, StatefulColumns, \
    StatefulInit, Limited

api = Api(api_name='example')
api.register(regex='model_example/$', resource=ModelExampleResource)
api.register(regex='model_computed_example/$', resource=ModelComputedExampleResource)
api.register(regex='limited/$', resource=Limited)
api.register(regex='stateful_columns/$', resource=StatefulColumns)
api.register(regex='stateful_init/$', resource=StatefulInit)
예제 #2
0
파일: api.py 프로젝트: bangoocms/bangoo
from restify.api import Api

from bangoo.content.api import resources as content_resources
from bangoo.navigation.api import resources as navigation_resources

api = Api(api_name='v1')
api.register(regex='content/(?P<menu_id>(\d+|new))/$', resource=content_resources.ContentResource)
api.register(regex='navigation/(?P<menu_id>(\d+|new))/$', resource=navigation_resources.MenuResource)
예제 #3
0
# coding: utf-8

from restify.api import Api

from yaat_examples.api.resources import ModelExampleResource, ModelComputedExampleResource, Stateful

api = Api(api_name='example')
api.register(regex='model_example/$', resource=ModelExampleResource)
api.register(regex='model_computed_example/$', resource=ModelComputedExampleResource)
api.register(regex='stateful/$', resource=Stateful)
예제 #4
0
 def test_api_register_resource(self):
     api = Api()
     api.register(r'first/$', CustomResource)
     self.assertEqual(len(api.urls), 1)
     self.assertIsInstance(api.urls[0], RegexURLPattern)
     self.assertEqual(api.urls[0].name, 'example')
예제 #5
0
 def test_api_urls_empty(self):
     api = Api()
     self.assertEqual(len(api.urls), 0)
     self.assertIsInstance(api.urls, list)
예제 #6
0
 def test_api_naming(self):
     api = Api()
     self.assertEqual(api.name, 'v1')
     api = Api(api_name='v2')
     self.assertEqual(api.name, 'v2')