# Class e.c.t.t.FooResourceProvider(ResourceProvider):

Part of elisa.core.tests.test_resource_manager View In Hierarchy

A stupid providers that just stores the last called method and its parameters

Line # | Kind | Name | Docs
--- | --- | --- | ---
44 | Method | get | Return a resource that `uri` is pointing to. A URI can point to
47 | Method | post | Update the resource pointed by `uri` with `parameters`.
50 | Method | delete | Delete a Resource represented by a URI.
53 | Method | put | Put one resource into another. Both resources are identified with URIs.

Inherited from Component (via ResourceProvider):

Line # | Kind | Name | Docs
--- | --- | --- | ---
85 | Class | PathDescriptor | Undocumented
97 | Class Method | create | Create and initialize the component.
130 | Method | initialize | Initialize the component.
142 | Method | clean | Clean the component.

Inherited from Loggable (via ResourceProvider, Component):

Line # | Kind | Name | Docs
--- | --- | --- | ---
81 | Method | __init__ | Undocumented

def get(self, uri, context_model=None):
overrides elisa.core.components.resource_provider.ResourceProvider.get

Return a resource that `uri` is pointing to. A URI can point to any kind of resource. Resources are returned as models.

The model that is returned does not always already contain all the resource. The deferred is fired when the resource loading is complete.

Parameters | uri | URI pointing to the resource (type: `elisa.core.media_uri.MediaUri` )
| context_model | the URI often comes from a certain context. For example a URI pointing to a MusicAlbum can come from a Model that could contain the album cover or the album name. If the context_model is provided the resource_provider should try to reuse its data if possible. (type: `elisa.core.components.model.Model` )
Returns | a new model and a deferred fired when the model is fully loaded (type: tuple of `elisa.core.components.model.Model` `elisa.core.utils.defer.Deferred` )

def post(self, uri, **parameters):
overrides elisa.core.components.resource_provider.ResourceProvider.post
Update the resource pointed by `uri` with `parameters`.

Parameters | uri | URI pointing to the resource to update (type: `elisa.core.media_uri.MediaUri` )
| parameters | parameters of the resource that should be updated
Returns | a deferred fired when the parameters got posted (type: `elisa.core.utils.defer.Deferred` )

def delete(self, uri):
overrides elisa.core.components.resource_provider.ResourceProvider.delete
Delete a Resource represented by a URI.

Parameters | uri | URI pointing to the resource that should be deleted (type: `elisa.media_uri.MediaUri` )
Returns | a deferred fired when the resource got deleted (type: `elisa.core.utils.defer.Deferred` )

def put(self, uri, uri2, source_model=None):
overrides elisa.core.components.resource_provider.ResourceProvider.put
Put one resource into another. Both resources are identified with URIs.

Parameters | source_uri | URI pointing to the resource that should be put into the other one (type: `elisa.core.media_uri.MediaUri` )
| container_uri | URI pointing to the resource that should receive the resource (type: `elisa.core.media_uri.MediaUri` )
| source_model | Often the resource behind the source_uri is already existing as a model-representation. To prevent from doing a 'get' for the given source_uri this model can also be given to the put request. (type: `elisa.core.components.model.Model` )
Returns | a deferred fired when the resource got put (type: `elisa.core.utils.defer.Deferred` )