An object representing a single Resource so that it is possible to relate a given REST request to a particularly entity in the model. For example this is used by the BOPAuthenticator on the server side to provide a whitelist of all resources exposed by a particular BOP.
- Version:
- 17.1.1
- Source:
Methods
(static) create(data) → {bop/js/api/resource/Resource}
stable API
A factory method that creates a resource.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object | An Object literal with following properties. Properties
|
- Version:
- 17.1.1
- Source:
Returns:
A new resource based on the passed in data
Example
var parent = Resource.create({
id: 'employee_collection',
template: '/employee',
entity: 'my.custom.bop.Employee'
});
(static) createChild(parent, data) → {bop/js/api/resource/Resource}
stable API
A factory method that creates a resource relative to the parent resource.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parent |
bop/js/api/resource/Resource | The parent resource to create the resource relative to |
||||||||||||||||
data |
Object | An Object literal with following properties. Properties
|
- Version:
- 17.1.1
- Source:
Returns:
A new resource based on the passed in data
Example
var parent = Resource.create({
id: 'employee_collection',
template: '/employee',
entity: 'my.custom.bop.Employee'
});
var child = Resource.createChild(parent, {
id: 'employee_instance',
template: '{id}'
});