Skip to content

Instantly share code, notes, and snippets.

@shwoodard
Forked from pablobm/app.adapters.stop.js
Created October 22, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shwoodard/3e7a314015daef71f97f to your computer and use it in GitHub Desktop.
Save shwoodard/3e7a314015daef71f97f to your computer and use it in GitHub Desktop.
Adding parameters to query
import Ember from 'ember';
import ApplicationAdapter from 'london-waits/pods/application/adapter';
import config from 'london-waits/config/environment';
function readStopId(id) {
return id.split(':')[0];
}
export default ApplicationAdapter.extend({
pathForType(type) {
Ember.assert(`Expected type='stop'. Got ${type}`, type === 'stop');
return 'StopPoint';
},
findRecord(store, type, id) {
id = readStopId(id);
return this._super(store, type, id);
},
query: function(store, type, query) {
Ember.$.extend(query, {
stopTypes: 'NaptanPublicBusCoachTram,NaptanRailEntrance,NaptanMetroStation',
modes: 'bus,overground,dlr,tube',
useStopPointHierarchy: false,
includeChildren: false,
returnLines: true,
radius: config.APP.vicinityRadius,
});
this._super.apply(this, arguments);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment