2017-03-13 20:58:26 -04:00
|
|
|
/* eslint-disable class-methods-use-this */
|
|
|
|
import Vue from 'vue';
|
2017-03-17 13:30:32 -04:00
|
|
|
import VueResource from 'vue-resource';
|
|
|
|
|
|
|
|
Vue.use(VueResource);
|
2016-11-03 17:38:54 -04:00
|
|
|
|
2017-03-13 20:58:26 -04:00
|
|
|
export default class EnvironmentsService {
|
2017-02-09 06:38:59 -05:00
|
|
|
constructor(endpoint) {
|
2017-03-28 06:56:24 -04:00
|
|
|
this.environments = Vue.resource(endpoint);
|
2017-03-29 07:52:17 -04:00
|
|
|
this.folderResults = 3;
|
2016-10-14 08:14:18 -04:00
|
|
|
}
|
2016-10-26 11:00:16 -04:00
|
|
|
|
2017-05-12 18:02:41 -04:00
|
|
|
get(options = {}) {
|
|
|
|
const { scope, page } = options;
|
2017-03-13 20:58:26 -04:00
|
|
|
return this.environments.get({ scope, page });
|
2016-10-14 08:14:18 -04:00
|
|
|
}
|
2016-12-14 01:51:53 -05:00
|
|
|
|
2017-03-13 20:58:26 -04:00
|
|
|
postAction(endpoint) {
|
|
|
|
return Vue.http.post(endpoint, {}, { emulateJSON: true });
|
|
|
|
}
|
2017-03-27 12:37:26 -04:00
|
|
|
|
2017-03-28 06:56:24 -04:00
|
|
|
getFolderContent(folderUrl) {
|
2017-03-29 07:52:17 -04:00
|
|
|
return Vue.http.get(`${folderUrl}.json?per_page=${this.folderResults}`);
|
2017-03-27 12:37:26 -04:00
|
|
|
}
|
2017-03-13 20:58:26 -04:00
|
|
|
}
|