Commit 48552d83 authored by Matija Obreza's avatar Matija Obreza

Get apiUrl from baseUrl

parent e0d30b1a
......@@ -56,7 +56,6 @@ public class GenesysClient {
private Token accessToken;
private Token refreshToken;
private String apiUrl;
private GenesysApi genesysApi = new GenesysApi();
private String apiKey;
private String apiSecret;
......@@ -78,7 +77,6 @@ public class GenesysClient {
final String baseUrl = properties.getProperty("base.url");
genesysApi.setBaseUrl(baseUrl);
this.apiUrl = baseUrl + properties.getProperty("api.url");
final String httpAuth = properties.getProperty("http.auth");
......@@ -126,7 +124,7 @@ public class GenesysClient {
}
for (int i = 0; i < 2; i++) {
OAuthRequest request = new OAuthRequest(method, this.apiUrl + url);
OAuthRequest request = new OAuthRequest(method, getApiUrl(url));
if (queryString != null && queryString.size() > 0) {
for (String key : queryString.keySet()) {
......@@ -184,6 +182,10 @@ public class GenesysClient {
return null;
}
private String getApiUrl(String url) {
return genesysApi.getBaseUrl().concat("/api/v0").concat(url);
}
/**
* Refresh accessToken with refreshToken
*
......@@ -336,4 +338,8 @@ public class GenesysClient {
public Token getRefreshToken() {
return refreshToken;
}
public String me() throws OAuthAuthenticationException, PleaseRetryException, GenesysApiException {
return query("/me");
}
}
......@@ -100,4 +100,8 @@ public class GenesysApi extends DefaultApi20 {
return getAccessTokenExtractor().extract(response.getBody());
}
public String getBaseUrl() {
return baseUrl;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment