- Source:
Methods
-
dispatch_detail(req, rep, next)
-
Dispatches detail requests which operated on a sigular, specific object
Parameters:
Name Type Description req
Request An express request object
rep
Response An express response object
next
function 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 bundle
Bundle 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 bundle
module:tastypie/lib/resource~Bundle callback
module: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 bundle
module:tastypie/lib/resource~Bundle An object represneting the current
OPTIONS
request- 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 bundle
module:tastypie/lib/resource~Bundle An object represneting the current
OPTIONS
request- Source:
-
patch_detail(bundle)
-
high level function called to handle PATCH requests
Parameters:
Name Type Description bundle
module:tastypie/lib/resource~Bundle An object represneting the current
PATCH
request- 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 bundle
module:tastypie/lib/resource~Bundle An object represneting the current
PUT
request- Source:
-
remove_object(bundle, callback)
-
Low level function called to delete existing objects
Parameters:
Name Type Description bundle
module:tastypie/lib/resource~Bundle An object represneting the current
DELETE
requestcallback
module: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 bundle
module:tastypie/lib/resource~Bundle An object represneting the current
PUT
requestcallback
module: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 bundle
module:tastypie/lib/resource~Bundle The data bundle representing the current request
callback
module:tastypie/lib/resource~Nodeback callback to be called when the operation finishes.
- Source: