The API that I’m working with doesn’t key stuff the way ember wants. Here is a screenshot of the API:
http://cloud.chrisblackwell.me/image/0G1B0m1M2z0A
Everything is under the key “data”. I’ve played around with Serializers and Adapters. Any help would be greatly appreciated.
So far I’ve got this to try and change to the data key, but it’s not working:
import DS from "ember-data";
export default DS.RESTSerializer.extend({
normalizeArrayResponse: function(store, primaryModelClass, payload, id, requestType) {
var pluralTypeKey = Ember.String.pluralize(requestType.typeKey);
payload[pluralTypeKey] = payload['data'];
delete payload['data'];
return this._super(store, primaryModelClass, payload, id, requestType);
}
});
Not sure if you’re already finished up with this, but given that you’ve already got a data
attribute, it might make the most sense to build a custom Serializer based on JSONAPI. It’s the wave of the Ember future and you’re already about half-way there.
More details are available here (http://www.ember-cli-mirage.com/docs/v0.1.x/working-with-json-api/) and I’ve got a sample commit you can look at here (https://github.com/acorncom/squarespace-adapter/commit/f2a56efb5662b101b2d8c424d4ff3fd88fb0dfc5 from when I was learning how to build a serializer for JSONAPI
That help?