17 lines
386 B
Java
17 lines
386 B
Java
package ru.dima.weather;
|
|
|
|
public class CityByIpResolver {
|
|
|
|
public static final String IP_INFO_URL = "https://ipinfo.io/city";
|
|
|
|
private HttpRequester httpRequester;
|
|
|
|
public CityByIpResolver(HttpRequester httpRequester) {
|
|
this.httpRequester = httpRequester;
|
|
}
|
|
|
|
public String getCurrentCityViaIP() {
|
|
return httpRequester.getString(IP_INFO_URL);
|
|
}
|
|
}
|