mirror of
https://github.com/Prominence/openweathermap-java-api.git
synced 2026-07-03 11:16:44 +03:00
Compare commits
40 Commits
2.4.0
..
5ca31780da
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ca31780da | |||
| 91a5acdb43 | |||
| 3f5b7f6649 | |||
| 9c2a127703 | |||
| e6833c3007 | |||
| d1bac609e8 | |||
| a17f687976 | |||
| 1ae02e0e49 | |||
| 46602e1f93 | |||
| 2553f13fbe | |||
| 905d3876c3 | |||
| 45f0b494b3 | |||
| 93b6b357c1 | |||
| c0dd184965 | |||
| 08d0aa091d | |||
| 93ae514550 | |||
| 2a15788569 | |||
| 37d7a2b3f5 | |||
| 6790848c32 | |||
| 23a1fa5a7b | |||
| 1cac951aaa | |||
| 58e648be42 | |||
| f30bcad5dc | |||
| 5793722181 | |||
| 40462397c1 | |||
| 44b543e65c | |||
| 13b20fc7e9 | |||
| 2a531dd683 | |||
| 1e1054903e | |||
| ff5b6c7a33 | |||
| db1cf858d8 | |||
| c2cc110dab | |||
| d4c2472254 | |||
| 380e3e458b | |||
| 246c07db97 | |||
| f19a627313 | |||
| 6438c323ff | |||
| 1cbff68338 | |||
| 1e08f4f8ae | |||
| bfa15fd9fe |
+13
@@ -0,0 +1,13 @@
|
|||||||
|
container:
|
||||||
|
image: gradle:jdk17
|
||||||
|
|
||||||
|
testCoverage_task:
|
||||||
|
gradle_cache:
|
||||||
|
folder: ~/.gradle/caches
|
||||||
|
testCoverage_script: gradle jacocoTestReport && bash <(curl -s https://codecov.io/bash)
|
||||||
|
cleanup_before_cache_script:
|
||||||
|
- rm -rf ~/.gradle/caches/$GRADLE_VERSION/
|
||||||
|
- rm -rf ~/.gradle/caches/transforms-1
|
||||||
|
- rm -rf ~/.gradle/caches/journal-1
|
||||||
|
- rm -rf ~/.gradle/caches/jars-3/*/buildSrc.jar
|
||||||
|
- find ~/.gradle/caches/ -name "*.lock" -type f -delete
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: "[BUG] Change me"
|
|
||||||
labels: bug
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '....'
|
|
||||||
3. Scroll down to '....'
|
|
||||||
4. See error
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
|
||||||
- OS: [e.g. iOS]
|
|
||||||
- Version [e.g. 22]
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
name: Custom issue template
|
|
||||||
about: Describe this issue template's purpose here.
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: "[FEATURE] Change me"
|
|
||||||
labels: enhancement
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: maven
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
time: "03:00"
|
||||||
|
open-pull-requests-limit: 10
|
||||||
|
target-branch: dev
|
||||||
@@ -13,10 +13,10 @@ name: "CodeQL"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [ dev ]
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches: [ master ]
|
branches: [ dev ]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '27 20 * * 1'
|
- cron: '27 20 * * 1'
|
||||||
|
|
||||||
|
|||||||
+2
-21
@@ -1,24 +1,5 @@
|
|||||||
# Compiled class file
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Log file
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# BlueJ files
|
|
||||||
*.ctxt
|
|
||||||
|
|
||||||
# Package Files #
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.nar
|
|
||||||
*.ear
|
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
*.rar
|
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
|
||||||
hs_err_pid*
|
|
||||||
|
|
||||||
*.iml
|
*.iml
|
||||||
.idea/
|
.idea/
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
target/
|
target/
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
language: java
|
|
||||||
|
|
||||||
jdk:
|
|
||||||
- openjdk8
|
|
||||||
- openjdk11
|
|
||||||
|
|
||||||
install: mvn install -DskipTests -Dgpg.skip -B
|
|
||||||
script: mvn test -Dmaven.skip.deploy=true -B
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
We as members, contributors, and leaders pledge to make participation in our
|
|
||||||
community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
||||||
identity and expression, level of experience, education, socio-economic status,
|
|
||||||
nationality, personal appearance, race, religion, or sexual identity
|
|
||||||
and orientation.
|
|
||||||
|
|
||||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
||||||
diverse, inclusive, and healthy community.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to a positive environment for our
|
|
||||||
community include:
|
|
||||||
|
|
||||||
* Demonstrating empathy and kindness toward other people
|
|
||||||
* Being respectful of differing opinions, viewpoints, and experiences
|
|
||||||
* Giving and gracefully accepting constructive feedback
|
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
||||||
and learning from the experience
|
|
||||||
* Focusing on what is best not just for us as individuals, but for the
|
|
||||||
overall community
|
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or
|
|
||||||
advances of any kind
|
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or email
|
|
||||||
address, without their explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
## Enforcement Responsibilities
|
|
||||||
|
|
||||||
Community leaders are responsible for clarifying and enforcing our standards of
|
|
||||||
acceptable behavior and will take appropriate and fair corrective action in
|
|
||||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
||||||
or harmful.
|
|
||||||
|
|
||||||
Community leaders have the right and responsibility to remove, edit, or reject
|
|
||||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
||||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
||||||
decisions when appropriate.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies within all community spaces, and also applies when
|
|
||||||
an individual is officially representing the community in public spaces.
|
|
||||||
Examples of representing our community include using an official e-mail address,
|
|
||||||
posting via an official social media account, or acting as an appointed
|
|
||||||
representative at an online or offline event.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
||||||
reported to the community leaders responsible for enforcement at
|
|
||||||
alexey.zinchenko@protonmail.com.
|
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
|
||||||
reporter of any incident.
|
|
||||||
|
|
||||||
## Enforcement Guidelines
|
|
||||||
|
|
||||||
Community leaders will follow these Community Impact Guidelines in determining
|
|
||||||
the consequences for any action they deem in violation of this Code of Conduct:
|
|
||||||
|
|
||||||
### 1. Correction
|
|
||||||
|
|
||||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
||||||
unprofessional or unwelcome in the community.
|
|
||||||
|
|
||||||
**Consequence**: A private, written warning from community leaders, providing
|
|
||||||
clarity around the nature of the violation and an explanation of why the
|
|
||||||
behavior was inappropriate. A public apology may be requested.
|
|
||||||
|
|
||||||
### 2. Warning
|
|
||||||
|
|
||||||
**Community Impact**: A violation through a single incident or series
|
|
||||||
of actions.
|
|
||||||
|
|
||||||
**Consequence**: A warning with consequences for continued behavior. No
|
|
||||||
interaction with the people involved, including unsolicited interaction with
|
|
||||||
those enforcing the Code of Conduct, for a specified period of time. This
|
|
||||||
includes avoiding interactions in community spaces as well as external channels
|
|
||||||
like social media. Violating these terms may lead to a temporary or
|
|
||||||
permanent ban.
|
|
||||||
|
|
||||||
### 3. Temporary Ban
|
|
||||||
|
|
||||||
**Community Impact**: A serious violation of community standards, including
|
|
||||||
sustained inappropriate behavior.
|
|
||||||
|
|
||||||
**Consequence**: A temporary ban from any sort of interaction or public
|
|
||||||
communication with the community for a specified period of time. No public or
|
|
||||||
private interaction with the people involved, including unsolicited interaction
|
|
||||||
with those enforcing the Code of Conduct, is allowed during this period.
|
|
||||||
Violating these terms may lead to a permanent ban.
|
|
||||||
|
|
||||||
### 4. Permanent Ban
|
|
||||||
|
|
||||||
**Community Impact**: Demonstrating a pattern of violation of community
|
|
||||||
standards, including sustained inappropriate behavior, harassment of an
|
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within
|
|
||||||
the community.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
||||||
version 2.0, available at
|
|
||||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
||||||
|
|
||||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
||||||
enforcement ladder](https://github.com/mozilla/diversity).
|
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see the FAQ at
|
|
||||||
https://www.contributor-covenant.org/faq. Translations are available at
|
|
||||||
https://www.contributor-covenant.org/translations.
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# OpenWeatherMap Java API [![Build Status][ci-shield]][ci-link] [![codecov][codecov-shield]][codecov-link]
|
# OpenWeatherMap Java API [![Build Status][ci-shield]][ci-link] [![codecov][codecov-shield]][codecov-link] [![FOSSA Status][FOSSA-shield]][FOSSA-link]
|
||||||
Java API for OpenWeatherMap services.
|
Java API for OpenWeatherMap services.
|
||||||
|
|
||||||
### Implemented features:
|
### Implemented features:
|
||||||
@@ -27,16 +27,48 @@ Paid:
|
|||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.prominence</groupId>
|
<groupId>com.github.prominence</groupId>
|
||||||
<artifactId>openweathermap-api</artifactId>
|
<artifactId>openweathermap-api</artifactId>
|
||||||
<version>2.4.0</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<repositories>
|
||||||
|
...
|
||||||
|
<!-- Repository for snapshot versions -->
|
||||||
|
<repository>
|
||||||
|
<id>oss.sonatype.org-snapshot</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
...
|
||||||
|
</repositories>
|
||||||
|
```
|
||||||
|
|
||||||
### Gradle coordinates:
|
### Gradle coordinates:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
implementation 'com.github.prominence:openweathermap-api:2.4.0'
|
implementation 'com.github.prominence:openweathermap-api:3.0.0-SNAPSHOT'
|
||||||
|
```
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
repositories {
|
||||||
|
...
|
||||||
|
// Repository for snapshot versions
|
||||||
|
maven {
|
||||||
|
url "https://oss.sonatype.org/content/repositories/snapshots"
|
||||||
|
mavenContent {
|
||||||
|
snapshotsOnly()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
...
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
@@ -49,14 +81,17 @@ implementation 'com.github.prominence:openweathermap-api:2.4.0'
|
|||||||
* [OpenWeatherMap Java API - 2.1.1](docs/Release_2.1.1.md)
|
* [OpenWeatherMap Java API - 2.1.1](docs/Release_2.1.1.md)
|
||||||
* [OpenWeatherMap Java API - 2.2.0](docs/Release_2.2.0.md)
|
* [OpenWeatherMap Java API - 2.2.0](docs/Release_2.2.0.md)
|
||||||
* [OpenWeatherMap Java API - 2.3.0](docs/Release_2.3.0.md)
|
* [OpenWeatherMap Java API - 2.3.0](docs/Release_2.3.0.md)
|
||||||
* [OpenWeatherMap Java API - 2.4.0](docs/Release_2.4.0.md)
|
* [OpenWeatherMap Java API - SNAPSHOT](docs/SNAPSHOT.md)
|
||||||
|
|
||||||
### License
|
### License
|
||||||
MIT
|
MIT
|
||||||
|
|
||||||
[ci-shield]: https://travis-ci.org/Prominence/openweathermap-java-api.svg?branch=master
|
[ci-shield]: https://api.cirrus-ci.com/github/Prominence/openweathermap-java-api.svg?branch=dev
|
||||||
[ci-link]: https://travis-ci.org/Prominence/openweathermap-java-api
|
[ci-link]: https://api.cirrus-ci.com/github/Prominence/openweathermap-java-api
|
||||||
|
|
||||||
|
|
||||||
[codecov-shield]: https://codecov.io/gh/Prominence/openweathermap-java-api/branch/master/graph/badge.svg
|
[codecov-shield]: https://codecov.io/gh/Prominence/openweathermap-java-api/branch/dev/graph/badge.svg
|
||||||
[codecov-link]: https://codecov.io/gh/Prominence/openweathermap-java-api
|
[codecov-link]: https://codecov.io/gh/Prominence/openweathermap-java-api
|
||||||
|
|
||||||
|
[FOSSA-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2FProminence%2Fopenweathermap-java-api.svg?type=shield
|
||||||
|
[FOSSA-link]: https://app.fossa.com/projects/git%2Bgithub.com%2FProminence%2Fopenweathermap-java-api?ref=badge_shield
|
||||||
|
|||||||
+112
@@ -0,0 +1,112 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
id 'maven-publish'
|
||||||
|
id 'signing'
|
||||||
|
id 'jacoco'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
maven {
|
||||||
|
url = uri('https://repo.maven.apache.org/maven2/')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
|
||||||
|
implementation 'org.slf4j:slf4j-api:1.7.36'
|
||||||
|
testImplementation 'org.junit.platform:junit-platform-runner:1.8.2'
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.github.prominence'
|
||||||
|
version = '3.0.0-SNAPSHOT'
|
||||||
|
description = 'Java OpenWeatherMap API'
|
||||||
|
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
|
ext {
|
||||||
|
isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
withJavadocJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
|
||||||
|
pom {
|
||||||
|
name = 'Java OpenWeatherMap API'
|
||||||
|
description = 'Java API for OpenWeatherMap services.'
|
||||||
|
url = 'https://github.com/Prominence/openweathermap-java-api'
|
||||||
|
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name = 'MIT License'
|
||||||
|
url = 'https://www.opensource.org/licenses/mit-license.php'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id = 'Prominence'
|
||||||
|
name = 'Alexey Zinchenko'
|
||||||
|
email = 'alexey.zinchenko@protonmail.com'
|
||||||
|
url = 'https://github.com/prominence'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
connection = 'scm:git:git://github.com/Prominence/openweathermap-java-api.git'
|
||||||
|
developerConnection = 'scm:git:git@github.com:prominence/openweathermap-java-api.git'
|
||||||
|
url = 'https://github.com/Prominence/openweathermap-java-api'
|
||||||
|
}
|
||||||
|
issueManagement {
|
||||||
|
url = 'https://github.com/Prominence/openweathermap-java-api/issues'
|
||||||
|
system = 'GitHub Issues'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
credentials {
|
||||||
|
username = project.findProperty('ossrhUsername')
|
||||||
|
password = project.findProperty('ossrhPassword')
|
||||||
|
}
|
||||||
|
|
||||||
|
url = isReleaseVersion ?
|
||||||
|
'https://oss.sonatype.org/service/local/staging/deploy/maven2/' :
|
||||||
|
'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
sign publishing.publications.mavenJava
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(GenerateModuleMetadata) {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
jacocoTestReport {
|
||||||
|
dependsOn test // tests are required to run before generating the report
|
||||||
|
reports {
|
||||||
|
csv.required = false
|
||||||
|
xml.enabled true
|
||||||
|
xml.destination file("${buildDir}/reports/jacoco/report.xml")
|
||||||
|
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
* Current weather data
|
* Current weather data
|
||||||
* 5 day / 3-hour forecast
|
* 5 day / 3-hour forecast
|
||||||
* One Call API
|
* One Call API
|
||||||
* One Call 3 API
|
|
||||||
* Air Pollution
|
* Air Pollution
|
||||||
|
|
||||||
|
|
||||||
@@ -13,16 +12,48 @@ Other:
|
|||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.prominence</groupId>
|
<groupId>com.github.prominence</groupId>
|
||||||
<artifactId>openweathermap-api</artifactId>
|
<artifactId>openweathermap-api</artifactId>
|
||||||
<version>2.4.0</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<repositories>
|
||||||
|
...
|
||||||
|
<!-- Repository for snapshot versions -->
|
||||||
|
<repository>
|
||||||
|
<id>oss.sonatype.org-snapshot</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
...
|
||||||
|
</repositories>
|
||||||
|
```
|
||||||
|
|
||||||
### Gradle coordinates:
|
### Gradle coordinates:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
compile('com.github.prominence:openweathermap-api:2.4.0')
|
implementation 'com.github.prominence:openweathermap-api:3.0.0-SNAPSHOT'
|
||||||
|
```
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
repositories {
|
||||||
|
...
|
||||||
|
// Repository for snapshot versions
|
||||||
|
maven {
|
||||||
|
url "https://oss.sonatype.org/content/repositories/snapshots"
|
||||||
|
mavenContent {
|
||||||
|
snapshotsOnly()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
...
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### How to use:
|
### How to use:
|
||||||
@@ -213,20 +244,7 @@ A forecast for Minsk with 15 timestamps.
|
|||||||
| `getDayTime()` | Returns enumerations representing the part of day(day, night). |
|
| `getDayTime()` | Returns enumerations representing the part of day(day, night). |
|
||||||
| `toString()` | Returns informative string for the forecast of particular timestamp. |
|
| `toString()` | Returns informative string for the forecast of particular timestamp. |
|
||||||
|
|
||||||
#### One Call 3 API
|
#### One Call API
|
||||||
Examples:
|
|
||||||
```java
|
|
||||||
final CurrentWeatherData currentWeatherData = getClient()
|
|
||||||
.oneCall3()
|
|
||||||
.current()
|
|
||||||
.byCoordinate(Coordinate.of(53.54, 27.34))
|
|
||||||
.language(Language.ENGLISH)
|
|
||||||
.unitSystem(UnitSystem.METRIC)
|
|
||||||
.retrieve()
|
|
||||||
.asJava();
|
|
||||||
```
|
|
||||||
|
|
||||||
#### One Call API (Deprecated)
|
|
||||||
Examples:
|
Examples:
|
||||||
```java
|
```java
|
||||||
final CurrentWeatherData currentWeatherData = openWeatherClient
|
final CurrentWeatherData currentWeatherData = openWeatherClient
|
||||||
@@ -560,7 +578,7 @@ final AirPollutionDetails airPollutionDetails = openWeatherClient
|
|||||||
| Unit.STANDARD_SYSTEM | Kelvin, meter/sec, hPa, mm(rain, snow). |
|
| Unit.STANDARD_SYSTEM | Kelvin, meter/sec, hPa, mm(rain, snow). |
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
* com.fasterxml.jackson.core:jackson-databind:2.13.4.2
|
* com.fasterxml.jackson.core:jackson-databind:2.13.2.2
|
||||||
* org.slf4j:slf4j-api:1.7.36 (*compile*)
|
* org.slf4j:slf4j-api:1.7.36 (*compile*)
|
||||||
* org.junit.jupiter:junit-jupiter-engine:5.8.2 (*test*)
|
* org.junit.jupiter:junit-jupiter-engine:5.8.2 (*test*)
|
||||||
* org.junit.platform:junit-platform-runner:1.8.2 (*test*)
|
* org.junit.platform:junit-platform-runner:1.8.2 (*test*)
|
||||||
Vendored
BIN
Binary file not shown.
+5
@@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+89
@@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>com.github.prominence</groupId>
|
|
||||||
<artifactId>openweathermap-api</artifactId>
|
|
||||||
<version>2.4.0</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>Java OpenWeatherMap API</name>
|
|
||||||
<description>Java API for OpenWeatherMap services.</description>
|
|
||||||
<url>https://github.com/Prominence/openweathermap-java-api</url>
|
|
||||||
|
|
||||||
<scm>
|
|
||||||
<url>https://github.com/Prominence/openweathermap-java-api</url>
|
|
||||||
<connection>scm:git:git://github.com/Prominence/openweathermap-java-api.git</connection>
|
|
||||||
<developerConnection>scm:git:git@github.com:prominence/openweathermap-java-api.git</developerConnection>
|
|
||||||
</scm>
|
|
||||||
|
|
||||||
<issueManagement>
|
|
||||||
<url>https://github.com/Prominence/openweathermap-java-api/issues</url>
|
|
||||||
<system>GitHub Issues</system>
|
|
||||||
</issueManagement>
|
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>MIT License</name>
|
|
||||||
<url>https://www.opensource.org/licenses/mit-license.php</url>
|
|
||||||
<distribution>repo</distribution>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<email>alexey.zinchenko@protonmail.com</email>
|
|
||||||
<name>Alexey Zinchenko</name>
|
|
||||||
<url>https://github.com/prominence</url>
|
|
||||||
<id>Prominence</id>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>ossrh</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
<repository>
|
|
||||||
<id>ossrh</id>
|
|
||||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>8</source>
|
|
||||||
<target>8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<version>3.2.0</version>
|
|
||||||
<configuration>
|
|
||||||
<excludes>
|
|
||||||
<exclude>**/test/*</exclude>
|
|
||||||
</excludes>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
|
||||||
<version>1.6.13</version>
|
|
||||||
<extensions>true</extensions>
|
|
||||||
<configuration>
|
|
||||||
<serverId>ossrh</serverId>
|
|
||||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
|
||||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
<version>3.2.1</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-sources</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar-no-fork</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
<version>3.3.0</version>
|
|
||||||
<configuration>
|
|
||||||
<source>8</source>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-javadocs</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
|
||||||
<version>3.0.1</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>sign-artifacts</id>
|
|
||||||
<phase>verify</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>sign</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.jacoco</groupId>
|
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
|
||||||
<version>0.8.7</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>prepare-agent</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>report</id>
|
|
||||||
<phase>test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>report</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.22.2</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>2.13.4.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<version>1.7.36</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
|
||||||
<version>5.8.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.platform</groupId>
|
|
||||||
<artifactId>junit-platform-runner</artifactId>
|
|
||||||
<version>1.8.2</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'openweathermap-api'
|
||||||
@@ -31,7 +31,6 @@ import com.github.prominence.openweathermap.api.request.onecall.OneCallWeatherRe
|
|||||||
import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequester;
|
import com.github.prominence.openweathermap.api.request.weather.CurrentWeatherRequester;
|
||||||
|
|
||||||
import static com.github.prominence.openweathermap.api.enums.SubscriptionPlan.ALL;
|
import static com.github.prominence.openweathermap.api.enums.SubscriptionPlan.ALL;
|
||||||
import static com.github.prominence.openweathermap.api.enums.SubscriptionPlan.SPECIAL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main public API client to communicate with OpenWeatherMap services.
|
* The main public API client to communicate with OpenWeatherMap services.
|
||||||
@@ -81,29 +80,10 @@ public class OpenWeatherMapClient {
|
|||||||
* @return requester for retrieving one call weather information.
|
* @return requester for retrieving one call weather information.
|
||||||
*/
|
*/
|
||||||
@SubscriptionAvailability(plans = ALL)
|
@SubscriptionAvailability(plans = ALL)
|
||||||
@Deprecated
|
|
||||||
public OneCallWeatherRequester oneCall() {
|
public OneCallWeatherRequester oneCall() {
|
||||||
return new OneCallWeatherRequester(new RequestSettings(apiKey, timeoutSettings));
|
return new OneCallWeatherRequester(new RequestSettings(apiKey, timeoutSettings));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* One Call 3 API <a href="https://openweathermap.org/api/one-call-3">API</a>.
|
|
||||||
* Includes a weather summary statement in addition to the information provided by {@link #oneCall()}
|
|
||||||
*
|
|
||||||
* Please note, that One Call API 3.0 is included in the "One Call by Call" subscription only.
|
|
||||||
* This separate subscription includes 1,000 calls/day for free and allows you to pay only for the number of API calls made to this product.
|
|
||||||
* Please note, that you do not need to subscribe to any other OpenWeather subscription plans to get access to the One Call API 3.0.
|
|
||||||
* Please find more details on the pricing page and FAQ or ask Ulla, OpenWeather AI assistant.
|
|
||||||
*
|
|
||||||
* @return requester for retrieving one call weather information for the OneCall 3 API.
|
|
||||||
*/
|
|
||||||
@SubscriptionAvailability(plans = SPECIAL)
|
|
||||||
public OneCallWeatherRequester oneCall3() {
|
|
||||||
RequestSettings requestSettings = new RequestSettings(apiKey, timeoutSettings);
|
|
||||||
requestSettings.setUseApi3();
|
|
||||||
return new OneCallWeatherRequester(requestSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Air Pollution <a href="https://openweathermap.org/api/air-pollution">API</a>.
|
* Air Pollution <a href="https://openweathermap.org/api/air-pollution">API</a>.
|
||||||
* Air Pollution API provides current, forecast and historical air pollution data for any coordinates on the globe.
|
* Air Pollution API provides current, forecast and historical air pollution data for any coordinates on the globe.
|
||||||
|
|||||||
@@ -56,9 +56,4 @@ public enum SubscriptionPlan {
|
|||||||
* All existing subscription plans.
|
* All existing subscription plans.
|
||||||
*/
|
*/
|
||||||
ALL,
|
ALL,
|
||||||
|
|
||||||
/**
|
|
||||||
* Special subscription cases.
|
|
||||||
*/
|
|
||||||
SPECIAL,
|
|
||||||
}
|
}
|
||||||
|
|||||||
-9
@@ -213,7 +213,6 @@ public class OneCallWeatherResponseMapper {
|
|||||||
daily.setMoonPhase(new MoonPhase(moonPhaseNode.asDouble()));
|
daily.setMoonPhase(new MoonPhase(moonPhaseNode.asDouble()));
|
||||||
}
|
}
|
||||||
|
|
||||||
daily.setSummary(parseSummary(dailyNode));
|
|
||||||
daily.setWeatherState(parseWeatherState(dailyNode.get("weather").get(0)));
|
daily.setWeatherState(parseWeatherState(dailyNode.get("weather").get(0)));
|
||||||
daily.setTemperature(parseDailyTemperature(dailyNode));
|
daily.setTemperature(parseDailyTemperature(dailyNode));
|
||||||
daily.setAtmosphericPressure(parsePressure(dailyNode));
|
daily.setAtmosphericPressure(parsePressure(dailyNode));
|
||||||
@@ -440,12 +439,4 @@ public class OneCallWeatherResponseMapper {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String parseSummary(JsonNode dailyNode) {
|
|
||||||
final JsonNode summaryNode = dailyNode.get("summary");
|
|
||||||
if(summaryNode != null) {
|
|
||||||
return summaryNode.asText();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-20
@@ -43,7 +43,6 @@ public class Daily {
|
|||||||
private LocalDateTime moonsetTime;
|
private LocalDateTime moonsetTime;
|
||||||
private MoonPhase moonPhase;
|
private MoonPhase moonPhase;
|
||||||
|
|
||||||
private String summary;
|
|
||||||
private WeatherState weatherState;
|
private WeatherState weatherState;
|
||||||
private DailyTemperature temperature;
|
private DailyTemperature temperature;
|
||||||
private AtmosphericPressure atmosphericPressure;
|
private AtmosphericPressure atmosphericPressure;
|
||||||
@@ -163,24 +162,6 @@ public class Daily {
|
|||||||
this.moonPhase = moonPhase;
|
this.moonPhase = moonPhase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets summary.
|
|
||||||
*
|
|
||||||
* @return the summary
|
|
||||||
*/
|
|
||||||
public String getSummary() {
|
|
||||||
return summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets summary.
|
|
||||||
*
|
|
||||||
* @param summary the summary
|
|
||||||
*/
|
|
||||||
public void setSummary(String summary) {
|
|
||||||
this.summary = summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets weather state.
|
* Gets weather state.
|
||||||
*
|
*
|
||||||
@@ -454,5 +435,4 @@ public class Daily {
|
|||||||
}
|
}
|
||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ public class RequestSettings {
|
|||||||
|
|
||||||
private Language language = Language.ENGLISH;
|
private Language language = Language.ENGLISH;
|
||||||
private UnitSystem unitSystem = UnitSystem.STANDARD;
|
private UnitSystem unitSystem = UnitSystem.STANDARD;
|
||||||
private boolean useApi3 = false;
|
|
||||||
|
|
||||||
public RequestSettings(String apiKey, TimeoutSettings timeoutSettings) {
|
public RequestSettings(String apiKey, TimeoutSettings timeoutSettings) {
|
||||||
this.putRequestParameter(API_KEY_PARAM_NAME, apiKey);
|
this.putRequestParameter(API_KEY_PARAM_NAME, apiKey);
|
||||||
@@ -95,14 +94,6 @@ public class RequestSettings {
|
|||||||
urlAppenderBuilder.append(appendix);
|
urlAppenderBuilder.append(appendix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseApi3() {
|
|
||||||
this.useApi3 = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getUseApi3() {
|
|
||||||
return this.useApi3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StringBuilder getUrlAppender() {
|
public StringBuilder getUrlAppender() {
|
||||||
return urlAppenderBuilder;
|
return urlAppenderBuilder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,13 @@ import com.github.prominence.openweathermap.api.request.RequestSettings;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -42,8 +44,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
public final class RequestUtils {
|
public final class RequestUtils {
|
||||||
|
|
||||||
private static final String OWM_URL_BASE = "https://api.openweathermap.org/data/2.5/";
|
private static final String OWM_URL_BASE = "http://api.openweathermap.org/data/2.5/";
|
||||||
private static final String OWM_URL_BASE_3_0 = "https://api.openweathermap.org/data/3.0/";
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(RequestUtils.class);
|
private static final Logger logger = LoggerFactory.getLogger(RequestUtils.class);
|
||||||
|
|
||||||
@@ -52,19 +53,10 @@ public final class RequestUtils {
|
|||||||
|
|
||||||
public static String getResponse(RequestSettings requestSettings) {
|
public static String getResponse(RequestSettings requestSettings) {
|
||||||
StringBuilder requestUrlBuilder = new StringBuilder(OWM_URL_BASE);
|
StringBuilder requestUrlBuilder = new StringBuilder(OWM_URL_BASE);
|
||||||
if(requestSettings.getUseApi3()) {
|
|
||||||
requestUrlBuilder = new StringBuilder(OWM_URL_BASE_3_0);
|
|
||||||
}
|
|
||||||
requestUrlBuilder.append(requestSettings.getUrlAppender());
|
requestUrlBuilder.append(requestSettings.getUrlAppender());
|
||||||
requestUrlBuilder.append('?');
|
requestUrlBuilder.append('?');
|
||||||
String parameters = requestSettings.getRequestParameters().entrySet().stream()
|
String parameters = requestSettings.getRequestParameters().entrySet().stream()
|
||||||
.map(entry -> {
|
.map(entry -> entry.getKey() + "=" + entry.getValue())
|
||||||
try {
|
|
||||||
return entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), "UTF-8");
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect(Collectors.joining("&"));
|
.collect(Collectors.joining("&"));
|
||||||
requestUrlBuilder.append(parameters);
|
requestUrlBuilder.append(parameters);
|
||||||
|
|
||||||
|
|||||||
-136
@@ -1,136 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2021 Alexey Zinchenko
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.github.prominence.openweathermap.api.request.onecall.current;
|
|
||||||
|
|
||||||
import com.github.prominence.openweathermap.api.ApiTest;
|
|
||||||
import com.github.prominence.openweathermap.api.OpenWeatherMapClient;
|
|
||||||
import com.github.prominence.openweathermap.api.enums.Language;
|
|
||||||
import com.github.prominence.openweathermap.api.enums.OneCallResultOptions;
|
|
||||||
import com.github.prominence.openweathermap.api.enums.UnitSystem;
|
|
||||||
import com.github.prominence.openweathermap.api.exception.InvalidAuthTokenException;
|
|
||||||
import com.github.prominence.openweathermap.api.exception.NoDataFoundException;
|
|
||||||
import com.github.prominence.openweathermap.api.model.Coordinate;
|
|
||||||
import com.github.prominence.openweathermap.api.model.onecall.current.CurrentWeatherData;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
public class CurrentWeatherOneCallApi3IntegrationTest extends ApiTest {
|
|
||||||
@Test
|
|
||||||
public void whenRetrieveCurrentOneCallResponseAsJava_thenOk() {
|
|
||||||
final CurrentWeatherData currentWeatherData = getClient()
|
|
||||||
.oneCall3()
|
|
||||||
.current()
|
|
||||||
.byCoordinate(Coordinate.of(53.54, 27.34))
|
|
||||||
.language(Language.ENGLISH)
|
|
||||||
.unitSystem(UnitSystem.METRIC)
|
|
||||||
.retrieve()
|
|
||||||
.asJava();
|
|
||||||
|
|
||||||
assertNotNull(currentWeatherData);
|
|
||||||
assertNotNull(currentWeatherData.getDailyList().get(0).getSummary());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenRetrieveCurrentOneCallResponseAsJSON_thenOk() {
|
|
||||||
final String responseJson = getClient()
|
|
||||||
.oneCall3()
|
|
||||||
.current()
|
|
||||||
.byCoordinate(Coordinate.of(53.54, 27.34))
|
|
||||||
.language(Language.ENGLISH)
|
|
||||||
.unitSystem(UnitSystem.METRIC)
|
|
||||||
.retrieve()
|
|
||||||
.asJSON();
|
|
||||||
|
|
||||||
assertNotNull(responseJson);
|
|
||||||
assertNotEquals("", responseJson);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenRetrieveCurrentOneCallResponseWithExclusionAsJava_thenOk() {
|
|
||||||
final CurrentWeatherData currentWeatherData = getClient()
|
|
||||||
.oneCall3()
|
|
||||||
.current()
|
|
||||||
.byCoordinate(Coordinate.of(53.54, 27.34))
|
|
||||||
.language(Language.ENGLISH)
|
|
||||||
.unitSystem(UnitSystem.METRIC)
|
|
||||||
.exclude(OneCallResultOptions.CURRENT, OneCallResultOptions.MINUTELY)
|
|
||||||
.retrieve()
|
|
||||||
.asJava();
|
|
||||||
|
|
||||||
assertNotNull(currentWeatherData);
|
|
||||||
assertNull(currentWeatherData.getCurrent());
|
|
||||||
assertNull(currentWeatherData.getMinutelyList());
|
|
||||||
assertNotNull(currentWeatherData.getDailyList().get(0).getSummary());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenRetrieveCurrentOneCallAsyncResponseAsJava_thenOk() throws ExecutionException, InterruptedException {
|
|
||||||
final CompletableFuture<CurrentWeatherData> currentWeatherDataFuture = getClient()
|
|
||||||
.oneCall3()
|
|
||||||
.current()
|
|
||||||
.byCoordinate(Coordinate.of(53.54, 27.34))
|
|
||||||
.language(Language.ENGLISH)
|
|
||||||
.unitSystem(UnitSystem.METRIC)
|
|
||||||
.retrieveAsync()
|
|
||||||
.asJava();
|
|
||||||
|
|
||||||
assertNotNull(currentWeatherDataFuture);
|
|
||||||
assertNotNull(currentWeatherDataFuture.get());
|
|
||||||
assertNotNull(currentWeatherDataFuture.get().getDailyList().get(0).getSummary());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenRetrieveCurrentOneCallAsyncResponseAsJSON_thenOk() throws ExecutionException, InterruptedException {
|
|
||||||
final CompletableFuture<String> responseJsonFuture = getClient()
|
|
||||||
.oneCall3()
|
|
||||||
.current()
|
|
||||||
.byCoordinate(Coordinate.of(53.54, 27.34))
|
|
||||||
.language(Language.ENGLISH)
|
|
||||||
.unitSystem(UnitSystem.METRIC)
|
|
||||||
.retrieveAsync()
|
|
||||||
.asJSON();
|
|
||||||
|
|
||||||
assertNotNull(responseJsonFuture);
|
|
||||||
final String responseJson = responseJsonFuture.get();
|
|
||||||
assertNotNull(responseJson);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenRequestOnecallWithInvalidApiKey_thenThrowAnException() {
|
|
||||||
OpenWeatherMapClient client = new OpenWeatherMapClient("invalidKey");
|
|
||||||
assertThrows(InvalidAuthTokenException.class, () ->
|
|
||||||
client
|
|
||||||
.oneCall3()
|
|
||||||
.current()
|
|
||||||
.byCoordinate(Coordinate.of(53.54, 27.34))
|
|
||||||
.language(Language.ENGLISH)
|
|
||||||
.unitSystem(UnitSystem.METRIC)
|
|
||||||
.retrieve()
|
|
||||||
.asJSON()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user