- Source:
Methods
-
dispatch_detail(req, rep, next)
-
Dispatches detail requests which operated on a sigular, specific object
Parameters:
Name Type Description reqRequest An express request object
repResponse An express response object
nextfunction An express next callback
- Source:
-
get_detail(bundle)
-
Top level method used to retreive indiidual objects by id.
This method handles caching results as well as reading from the cacheParameters:
Name Type Description bundleBundle A bundle representing the current request.
- Source:
-
get_object(bundle, callback)
-
Method used to retrieve a specific object
NOTE This method must be implement for specific use cases. The default does not implement this methodParameters:
Name Type Description bundlemodule:tastypie/lib/resource~Bundle callbackmodule:tastypie/lib/resource~Nodeback - Source:
Examples
var MyResource = Resource.extend({ get_object: function( bundle, callback ){ Model.get( bundle.req.params.pk, callback ) } })var MyResource = new Class({ inherits: Resource , get_object: function( bundle, callback ){ this.get_objects(bundle,function(e, objects){ var obj = JSON.parse( objects ).filter(function( obj ){ return obj._id = bundle.req.params.pk })[0] callback( null, obj ) }) } }) -
options_detail(bundle)
-
High level function called in response to an OPTIONS request. Returns with an Allow header and empty body
Parameters:
Name Type Description bundlemodule:tastypie/lib/resource~Bundle An object represneting the current
OPTIONSrequest- Source:
-
options_detail(bundle)
-
High level function called in response to an OPTIONS request. Returns with an Allow header and empty body
Parameters:
Name Type Description bundlemodule:tastypie/lib/resource~Bundle An object represneting the current
OPTIONSrequest- Source:
-
patch_detail(bundle)
-
high level function called to handle PATCH requests
Parameters:
Name Type Description bundlemodule:tastypie/lib/resource~Bundle An object represneting the current
PATCHrequest- Source:
-
put_detail(bundle)
-
Top level method used to handle post request to listing endpoints. Used to update instances with supplied data
Parameters:
Name Type Description bundlemodule:tastypie/lib/resource~Bundle An object represneting the current
PUTrequest- Source:
-
remove_object(bundle, callback)
-
Low level function called to delete existing objects
Parameters:
Name Type Description bundlemodule:tastypie/lib/resource~Bundle An object represneting the current
DELETErequestcallbackmodule:tastypie/lib/resource~NodeBack a callback to be caled when finished
- Source:
-
replace_object(bundle, callback)
-
Low level function called to replace existing objects
Parameters:
Name Type Description bundlemodule:tastypie/lib/resource~Bundle An object represneting the current
PUTrequestcallbackmodule:tastypie/lib/resource~NodeBack a callback to be caled when finished
- Source:
-
update_object(bundle, callback)
-
Method that is responsibe for updating a specific object during a PUT request
Parameters:
Name Type Description bundlemodule:tastypie/lib/resource~Bundle The data bundle representing the current request
callbackmodule:tastypie/lib/resource~Nodeback callback to be called when the operation finishes.
- Source: