get
Retrieve a single instance from the connection data source.
connection.get(params)
Retrieves instance data from getData, runs the resulting data through hydrateInstance, creating a typed instance with the retrieved data.
Parameters
- params
{Object}:data specifying the instance to retrieve. Normally, this is something like like:
{id: 5}.
Returns
{Promise<Instance>}:
Promise resolving to the instance returned by
hydrateInstance.
Usage
Call .get() with the parameters that identify the instance you want to load. .get() will return a promise
that resolves to that instance:
todoConnection.get({id: 6}).then(function(todo){
todo.id; // 6
todo.name; // 'Take out the garbage'
});
.get() above will call getData on the data/url
behavior, which will make an HTTP GET request to /todos/6.