Merge branch 'hotfix/1.4.2'
This commit is contained in:
commit
0f8689b701
3 changed files with 19 additions and 3 deletions
|
@ -1,10 +1,10 @@
|
|||
/* global axios */
|
||||
|
||||
const API_VERSION = `/api/v1`;
|
||||
const DEFAULT_API_VERSION = 'v1';
|
||||
|
||||
class ApiClient {
|
||||
constructor(resource, options = {}) {
|
||||
this.apiVersion = API_VERSION;
|
||||
this.apiVersion = `/api/${options.apiVersion || DEFAULT_API_VERSION}`;
|
||||
this.options = options;
|
||||
this.resource = resource;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import ApiClient from './ApiClient';
|
|||
|
||||
class ReportsAPI extends ApiClient {
|
||||
constructor() {
|
||||
super('reports', { accountScoped: true });
|
||||
super('reports', { accountScoped: true, apiVersion: 'v2' });
|
||||
}
|
||||
|
||||
getAccountReports(metric, since, until) {
|
||||
|
|
16
app/javascript/dashboard/api/specs/reports.spec.js
Normal file
16
app/javascript/dashboard/api/specs/reports.spec.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import reports from '../reports';
|
||||
import ApiClient from '../ApiClient';
|
||||
|
||||
describe('#Reports API', () => {
|
||||
it('creates correct instance', () => {
|
||||
expect(reports).toBeInstanceOf(ApiClient);
|
||||
expect(reports.apiVersion).toBe('/api/v2');
|
||||
expect(reports).toHaveProperty('get');
|
||||
expect(reports).toHaveProperty('show');
|
||||
expect(reports).toHaveProperty('create');
|
||||
expect(reports).toHaveProperty('update');
|
||||
expect(reports).toHaveProperty('delete');
|
||||
expect(reports).toHaveProperty('getAccountReports');
|
||||
expect(reports).toHaveProperty('getAccountSummary');
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue