Ejemplo n.º 1
0
 def users(self, id):
     """Return a CollectionProxy to all the users for the specified Company."""
     collection = utils.resource_class_to_collection_name(
         self.collection_class)
     finder_url = "/%s/%s/users" % (collection, id)
     return CollectionProxy(self.client, self.collection_class, "users",
                            finder_url)
Ejemplo n.º 2
0
 def all(self):
     """Return a CollectionProxy for the resource."""
     collection = utils.resource_class_to_collection_name(
         self.collection_class)
     finder_url = "/%s" % (collection)
     return CollectionProxy(
         self.client, self.collection_class, collection, finder_url)
 def by_tag(self, _id):
     """Return a CollectionProxy to all the tagged resources."""
     collection = utils.resource_class_to_collection_name(
         self.collection_class)
     finder_url = "/%s?tag_id=%s" % (collection, _id)
     return CollectionProxy(self.client, self.collection_class, collection,
                            finder_url)
Ejemplo n.º 4
0
 def find_all(cls, **params):
     collection = utils.resource_class_to_collection_name(cls)
     if 'id' in params and 'type' not in params:
         finder_url = "/%s/%s" % (collection, params['id'])
     else:
         finder_url = "/%s" % (collection)
     finder_params = params
     return CollectionProxy(cls, collection, finder_url, finder_params)
Ejemplo n.º 5
0
 def users(self):
     collection = utils.resource_class_to_collection_name(self.__class__)
     finder_url = "/%s/%s/users" % (collection, self.id)
     return CollectionProxy(User, "users", finder_url)
Ejemplo n.º 6
0
 def all(cls):
     collection = utils.resource_class_to_collection_name(cls)
     finder_url = "/%s" % (collection)
     return CollectionProxy(cls, collection, finder_url)