
This commit adds adapters and serializers for v3, but also a fallback serializer for v2, which allows to handle v2 and v3 payloads at the same time. This is needed, because when we use v3 endpoint for one of the models (in this case repo), we can also get embedded records of other types (like branch or build).
25 lines
544 B
JavaScript
25 lines
544 B
JavaScript
import V3Adapter from 'travis/adapters/v3';
|
|
|
|
export default V3Adapter.extend({
|
|
buildUrl(modelName, id, snapshot, requestType, query) {
|
|
var url = this._super(...arguments);
|
|
|
|
return url;
|
|
},
|
|
|
|
ajaxOptions(url, type, options) {
|
|
var hash = options || {};
|
|
if(!hash.data) {
|
|
hash.data = {};
|
|
}
|
|
|
|
if(hash.data.include) {
|
|
hash.data.include += ',repository.last_build,build.commit';
|
|
} else {
|
|
hash.data.include = 'repository.last_build,build.commit';
|
|
}
|
|
|
|
return this._super(url, type, hash);
|
|
}
|
|
});
|