Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
feat(payg): add routes required for payg
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisay committed Jul 23, 2018
1 parent 3f7946e commit 791f011
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/auth/auth.v6.service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module("ovh-api-services").service("OvhApiAuthV6", function ($resource) {
angular.module("ovh-api-services").service("OvhApiAuthV6", function ($resource, $http) {
"use strict";

return $resource(
Expand All @@ -8,6 +8,21 @@ angular.module("ovh-api-services").service("OvhApiAuthV6", function ($resource)
url: "/auth/logout",
method: "POST",
isArray: false
},
time: {
url: "/auth/time",
method: "GET",
isArray: false,
transformResponse: $http.defaults.transformResponse.concat(function (raw, headers, status) {
var result = {};
if (status === 403) {
result.value = false;
result.message = raw.message;
} else {
result.value = raw;
}
return result;
})
}
}
);
Expand Down
3 changes: 3 additions & 0 deletions src/cloud/project/cloud-project.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ angular.module("ovh-api-services").service("OvhApiCloudProject", function ($inje
},
Stack: function () {
return $injector.get("OvhApiCloudProjectStack");
},
Volume: function () {
return $injector.get("OvhApiCloudProjectVolume");
}
};

Expand Down
12 changes: 11 additions & 1 deletion src/me/me.v6.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ angular.module("ovh-api-services").service("OvhApiMeV6", function ($resource, $c
var me = $resource("/me", {}, {
get: { method: "GET", cache: cache },
update: { method: "PUT", interceptor: interceptor },
schema: { method: "GET", url: "/me.json" }
schema: { method: "GET", url: "/me.json" },
consumption: {
method: "GET",
url: "/me/consumption/usage/current",
isArray: true
},
consumptionHistory: {
method: "GET",
url: "/me/consumption/usage/history",
isArray: true
}
});

me.resetCache = function () {
Expand Down
3 changes: 3 additions & 0 deletions src/services/services.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ angular.module("ovh-api-services").service("OvhApiServices", function ($injector
return {
Aapi: function () {
return $injector.get("OvhApiServicesAapi");
},
v6: function () {
return $injector.get("OvhApiServicesV6");
}
};
});
8 changes: 8 additions & 0 deletions src/services/services.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module("ovh-api-services").service("OvhApiServicesV6", function ($resource) {
"use strict";

return $resource("/services/:serviceId", {
serviceId: "@serviceId"
});

});

0 comments on commit 791f011

Please sign in to comment.