Skip to content

Commit 4cfa8ab

Browse files
authored
2.1.0 version implementation.
1 parent 196f9ec commit 4cfa8ab

File tree

126 files changed

+11394
-1693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+11394
-1693
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ Java API for OpenWeatherMap services.
55
Free:
66
* Current weather data
77
* 5 day / 3-hour forecast
8+
* One Call API
89

910
### Will be implemented later:
1011

1112
Free:
12-
* One Call API
1313
* Air pollution
1414
* Geocoding API
1515
* Weather Stations
@@ -26,14 +26,14 @@ Paid:
2626
<dependency>
2727
<groupId>com.github.prominence</groupId>
2828
<artifactId>openweathermap-api</artifactId>
29-
<version>2.0.1</version>
29+
<version>2.1.0</version>
3030
</dependency>
3131
```
3232

3333
### Gradle coordinates:
3434

3535
```groovy
36-
compile('com.github.prominence:openweathermap-api:2.0.1')
36+
compile('com.github.prominence:openweathermap-api:2.1.0')
3737
```
3838

3939
### Documentation
@@ -42,6 +42,7 @@ compile('com.github.prominence:openweathermap-api:2.0.1')
4242
* [OpenWeatherMap Java API - 1.2](docs/Release_1.2.md)
4343
* [OpenWeatherMap Java API - 2.0.0](docs/Release_2.0.0.md)
4444
* [OpenWeatherMap Java API - 2.0.1](docs/Release_2.0.1.md)
45+
* [OpenWeatherMap Java API - 2.1.0](docs/Release_2.1.0.md)
4546
* [OpenWeatherMap Java API - SNAPSHOT](docs/SNAPSHOT.md)
4647

4748
### License

docs/Release_2.0.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ final Weather weather = openWeatherClient
7979
final List<Weather> weatherList = openWeatherClient
8080
.currentWeather()
8181
.multiple()
82-
.byCitiesInCycle(Coordinate.withValues(55.5, 37.5))
82+
.byCitiesInCycle(Coordinate.of(55.5, 37.5))
8383
.language(Language.GERMAN)
8484
.unitSystem(UnitSystem.IMPERIAL)
8585
.retrieve()

docs/Release_2.0.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ final Weather weather = openWeatherClient
7979
final List<Weather> weatherList = openWeatherClient
8080
.currentWeather()
8181
.multiple()
82-
.byCitiesInCycle(Coordinate.withValues(55.5, 37.5))
82+
.byCitiesInCycle(Coordinate.of(55.5, 37.5))
8383
.language(Language.GERMAN)
8484
.unitSystem(UnitSystem.IMPERIAL)
8585
.retrieve()

docs/Release_2.1.0.md

Lines changed: 484 additions & 0 deletions
Large diffs are not rendered by default.

docs/SNAPSHOT.md

Lines changed: 243 additions & 14 deletions
Large diffs are not rendered by default.

pom.xml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.prominence</groupId>
88
<artifactId>openweathermap-api</artifactId>
9-
<version>2.0.1</version>
9+
<version>2.1.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Java OpenWeatherMap API</name>
@@ -27,7 +27,7 @@
2727
<licenses>
2828
<license>
2929
<name>MIT License</name>
30-
<url>http://www.opensource.org/licenses/mit-license.php</url>
30+
<url>https://www.opensource.org/licenses/mit-license.php</url>
3131
<distribution>repo</distribution>
3232
</license>
3333
</licenses>
@@ -150,6 +150,12 @@
150150
</execution>
151151
</executions>
152152
</plugin>
153+
154+
<plugin>
155+
<groupId>org.apache.maven.plugins</groupId>
156+
<artifactId>maven-surefire-plugin</artifactId>
157+
<version>2.22.2</version>
158+
</plugin>
153159
</plugins>
154160
</build>
155161

@@ -167,10 +173,15 @@
167173
</dependency>
168174

169175
<dependency>
170-
<groupId>junit</groupId>
171-
<artifactId>junit</artifactId>
172-
<version>4.13.1</version>
176+
<groupId>org.junit.jupiter</groupId>
177+
<artifactId>junit-jupiter-engine</artifactId>
178+
<version>5.7.1</version>
173179
<scope>test</scope>
174180
</dependency>
181+
<dependency>
182+
<groupId>org.junit.platform</groupId>
183+
<artifactId>junit-platform-runner</artifactId>
184+
<version>1.7.1</version>
185+
</dependency>
175186
</dependencies>
176187
</project>

src/main/java/com/github/prominence/openweathermap/api/OpenWeatherMapClient.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import com.github.prominence.openweathermap.api.annotation.SubscriptionAvailability;
2626
import com.github.prominence.openweathermap.api.request.forecast.free.FiveDayThreeHourStepForecastRequester;
2727
import com.github.prominence.openweathermap.api.request.forecast.free.FiveDayThreeHourStepForecastRequesterImpl;
28+
import com.github.prominence.openweathermap.api.request.onecall.OneCallWeatherRequester;
29+
import com.github.prominence.openweathermap.api.request.onecall.OneCallWeatherRequesterImpl;
2830
import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequester;
2931
import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequesterImpl;
3032

@@ -39,7 +41,7 @@ public class OpenWeatherMapClient {
3941

4042
/**
4143
* Created OpenWeatherMap client object.
42-
* @param apiKey API key obtained on <a href="https://home.openweathermap.org/api_keys">OpwnWeatherMap site</a>.
44+
* @param apiKey API key obtained on <a href="https://home.openweathermap.org/api_keys">OpenWeatherMap site</a>.
4345
*/
4446
public OpenWeatherMapClient(String apiKey) {
4547
this.apiKey = apiKey;
@@ -62,4 +64,14 @@ public CurrentWeatherRequester currentWeather() {
6264
public FiveDayThreeHourStepForecastRequester forecast5Day3HourStep() {
6365
return new FiveDayThreeHourStepForecastRequesterImpl(apiKey);
6466
}
67+
68+
/**
69+
* One Call <a href="https://openweathermap.org/api/one-call-api">API</a>.
70+
* To get information about current weather, minute forecast for 1 hour, hourly forecast for 48 hours, daily forecast for 7 days and government weather alerts.
71+
* @return requester for retrieving one call weather information.
72+
*/
73+
@SubscriptionAvailability(plans = ALL)
74+
public OneCallWeatherRequester oneCall() {
75+
return new OneCallWeatherRequesterImpl(apiKey);
76+
}
6577
}

src/main/java/com/github/prominence/openweathermap/api/enums/Language.java

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,26 @@
2727
* Usually it could be specified to get response with some fields translated into desired language.
2828
*/
2929
public enum Language {
30+
/**
31+
* Afrikaans language.
32+
*/
33+
AFRIKAANS("af"),
34+
35+
/**
36+
* Albanian language.
37+
*/
38+
ALBANIAN("al"),
39+
3040
/**
3141
* Arabic language.
3242
*/
3343
ARABIC("ar"),
3444

45+
/**
46+
* Azerbaijani language.
47+
*/
48+
AZERBAIJANI("az"),
49+
3550
/**
3651
* Bulgarian language.
3752
*/
@@ -47,6 +62,11 @@ public enum Language {
4762
*/
4863
CZECH("cz"),
4964

65+
/**
66+
* Danish language
67+
*/
68+
DANISH("da"),
69+
5070
/**
5171
* German language.
5272
*/
@@ -62,6 +82,11 @@ public enum Language {
6282
*/
6383
ENGLISH("en"),
6484

85+
/**
86+
* Basque language.
87+
*/
88+
BASQUE("eu"),
89+
6590
/**
6691
* Persian language.
6792
*/
@@ -82,6 +107,16 @@ public enum Language {
82107
*/
83108
GALICIAN("gl"),
84109

110+
/**
111+
* Hebrew language.
112+
*/
113+
HEBREW("he"),
114+
115+
/**
116+
* Hindi language.
117+
*/
118+
HINDI("hi"),
119+
85120
/**
86121
* Croatian language.
87122
*/
@@ -92,6 +127,11 @@ public enum Language {
92127
*/
93128
HUNGARIAN("hu"),
94129

130+
/**
131+
* Indonesian language.
132+
*/
133+
INDONESIAN("id"),
134+
95135
/**
96136
* Italian language.
97137
*/
@@ -122,6 +162,11 @@ public enum Language {
122162
*/
123163
MACEDONIAN("mk"),
124164

165+
/**
166+
* Norwegian language.
167+
*/
168+
NORWEGIAN("no"),
169+
125170
/**
126171
* Dutch language.
127172
*/
@@ -137,6 +182,11 @@ public enum Language {
137182
*/
138183
PORTUGUESE("pt"),
139184

185+
/**
186+
* Português Brasil language.
187+
*/
188+
PORTUGUES_BRAZIL("pt_br"),
189+
140190
/**
141191
* Romanian language.
142192
*/
@@ -165,7 +215,17 @@ public enum Language {
165215
/**
166216
* Spanish language.
167217
*/
168-
SPANISH("en"),
218+
SPANISH("es"),
219+
220+
/**
221+
* Serbian language.
222+
*/
223+
SERBIAN("sr"),
224+
225+
/**
226+
* Thai language.
227+
*/
228+
THAI("th"),
169229

170230
/**
171231
* Turkish language.
@@ -190,7 +250,12 @@ public enum Language {
190250
/**
191251
* Chinese traditional language.
192252
*/
193-
CHINESE_TRADITIONAL("zh_tw");
253+
CHINESE_TRADITIONAL("zh_tw"),
254+
255+
/**
256+
* Zulu language.
257+
*/
258+
ZULU("zu");
194259

195260
private final String value;
196261

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2021 Alexey Zinchenko
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
23+
package com.github.prominence.openweathermap.api.enums;
24+
25+
/**
26+
* The enum One call result options.
27+
*/
28+
public enum OneCallResultOptions {
29+
/**
30+
* Current one call result options.
31+
*/
32+
CURRENT("current"),
33+
/**
34+
* Minutely one call result options.
35+
*/
36+
MINUTELY("minutely"),
37+
/**
38+
* Hourly one call result options.
39+
*/
40+
HOURLY("hourly"),
41+
/**
42+
* Daily one call result options.
43+
*/
44+
DAILY("daily"),
45+
/**
46+
* Alerts one call result options.
47+
*/
48+
ALERTS("alerts");
49+
50+
private final String value;
51+
52+
OneCallResultOptions(String value) {
53+
this.value = value;
54+
}
55+
56+
/**
57+
* Gets value.
58+
*
59+
* @return the value
60+
*/
61+
public String getValue() {
62+
return value;
63+
}
64+
}

0 commit comments

Comments
 (0)