Little ZabbixAPIService refactor.
This commit is contained in:
@@ -32,7 +32,7 @@ function (angular, _) {
|
||||
p.request = function(method, params) {
|
||||
var self = this;
|
||||
if (this.auth) {
|
||||
return ZabbixAPIService._request(this.url, method, params, this.requestOptions, this.auth)
|
||||
return ZabbixAPIService.request(this.url, method, params, this.requestOptions, this.auth)
|
||||
.then(function(result) {
|
||||
return result;
|
||||
},
|
||||
@@ -43,7 +43,7 @@ function (angular, _) {
|
||||
return ZabbixAPIService.login(self.url, self.username, self.password, self.requestOptions)
|
||||
.then(function(auth) {
|
||||
self.auth = auth;
|
||||
return ZabbixAPIService._request(self.url, method, params, self.requestOptions, self.auth);
|
||||
return ZabbixAPIService.request(self.url, method, params, self.requestOptions, self.auth);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -53,7 +53,7 @@ function (angular, _) {
|
||||
return ZabbixAPIService.login(this.url, this.username, this.password, this.requestOptions)
|
||||
.then(function(auth) {
|
||||
self.auth = auth;
|
||||
return ZabbixAPIService._request(self.url, method, params, self.requestOptions, self.auth);
|
||||
return ZabbixAPIService.request(self.url, method, params, self.requestOptions, self.auth);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ function (angular) {
|
||||
* Request data from Zabbix API
|
||||
* @return {object} response.result
|
||||
*/
|
||||
this._request = function(api_url, method, params, options, auth) {
|
||||
this.request = function(api_url, method, params, options, auth) {
|
||||
var requestData = {
|
||||
jsonrpc: '2.0',
|
||||
method: method,
|
||||
@@ -70,7 +70,7 @@ function (angular) {
|
||||
user: username,
|
||||
password: password
|
||||
};
|
||||
return this._request(api_url, 'user.login', params, options, null);
|
||||
return this.request(api_url, 'user.login', params, options, null);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ function (angular) {
|
||||
* Matches the version of Zabbix starting from Zabbix 2.0.4
|
||||
*/
|
||||
this.getVersion = function(api_url, options) {
|
||||
return this._request(api_url, 'apiinfo.version', [], options);
|
||||
return this.request(api_url, 'apiinfo.version', [], options);
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user