Skip to content

Commit

Permalink
Merge pull request #21 from xSAVIKx/release/v1.4.0
Browse files Browse the repository at this point in the history
Release/v1.4.0
  • Loading branch information
xSAVIKx authored Jun 20, 2021
2 parents 5915d31 + 54594e0 commit b482f26
Show file tree
Hide file tree
Showing 166 changed files with 3,165 additions and 418 deletions.
19 changes: 18 additions & 1 deletion .bin/gitconfig.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
#!/usr/bin/env bash

#
# Copyright 2021, Yurii Serhiichuk
#
# 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
#
# http://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.
#
#

# Set colors
GREEN='\033[1;32m'
CYAN='\033[1;36m'
Expand Down Expand Up @@ -39,4 +56,4 @@ git config --local include.path "${GITCONFIG_PATH}"
printf "${GREEN}.gitconfig path was successfully set to '${GITCONFIG_PATH}'.${NC}"
echo
printf "${GREEN}----${NC}"
echo
echo
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* text=auto

*.bat text eol=crlf
*.sh text eol=lf

#
# The above will handle all files NOT found below
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:

jobs:
build:
name: Test on Java ${{ matrix.java }} and ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
java: [ 8, 11, 15 ]
os: [ ubuntu-latest, windows-latest, macos-latest ]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
java-package: 'jdk'
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --stacktrace
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENWEATHERMAP_API_KEY: ${{ secrets.OPENWEATHERMAP_API_KEY }}
- uses: codecov/codecov-action@v1
deploy:
name: Deploy packages
runs-on: ubuntu-20.04
needs: [ build ]
if: contains('
refs/heads/development
refs/heads/master
', github.ref)
&& github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'zulu'
java-package: 'jdk'
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish to GitHub Packages
run: ./gradlew publish --stacktrace
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENWEATHERMAP_API_KEY: ${{ secrets.OPENWEATHERMAP_API_KEY }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,6 @@ $RECYCLE.BIN/

# betamax ignores
littleproxy_cert
*.jks
*.jks

gradle.properties
7 changes: 7 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/copyright/xsavikx_opensource.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2017 Yuri Sergiichuk
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
openweathermap-java-api [![Build Status][ci-shield]][ci-link] [![Download][bintray-shield]][bintray-link] [![codecov][codecov-shield]][codecov-link]
openweathermap-java-api
[![Build Status][ci-badge]][ci-link]
[![codecov][codecov-badge]][codecov-link]
=====

To use the OpenweatherMap API, you need to obtain an API key. Sign up [here][openweathermap-signup].
To use the OpenweatherMap API, you need to obtain an API key. Sign up [here][openweathermap-signup].


[openweathermap-signup]: http://home.openweathermap.org/users/sign_up
Expand Down Expand Up @@ -71,17 +73,17 @@ CATALAN("ca");
- Metric
- Imperial

More information about weather parameters and unit can be found [here](http://openweathermap.org/weather-data).
More information about weather parameters and unit can be
found [here](http://openweathermap.org/weather-data).

## Examples

Take a look at [examples module](./api-examples)

[ci-shield]: https://travis-ci.org/xSAVIKx/openweathermap-java-api.svg?branch=development
[ci-link]: https://travis-ci.org/xSAVIKx/openweathermap-java-api
[ci-badge]: https://github.com/xSAVIKx/openweathermap-java-api/actions/workflows/ci.yaml/badge.svg

[bintray-shield]: https://api.bintray.com/packages/xsavikx/openweathermap-java-api/api-core/images/download.svg
[bintray-link]: https://bintray.com/xsavikx/openweathermap-java-api/api-core/_latestVersion
[ci-link]: https://github.com/xSAVIKx/openweathermap-java-api/actions/workflows/ci.yaml

[codecov-badge]: https://codecov.io/gh/xSAVIKx/openweathermap-java-api/branch/development/graph/badge.svg

[codecov-shield]: https://codecov.io/gh/xSAVIKx/openweathermap-java-api/branch/development/graph/badge.svg
[codecov-link]: https://codecov.io/gh/xSAVIKx/openweathermap-java-api
19 changes: 18 additions & 1 deletion api-common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
/*
* Copyright 2021, Yurii Serhiichuk
*
* 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
*
* http://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.
*
*/

dependencies {
compile deps.gson
api deps.gson
}

appendPomDescription('Java API to access openweathermap.org API common elements')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright 2021, Yurii Serhiichuk
*
* 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
*
* http://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.
*
*/

package org.openweathermap.api.common;

import com.google.gson.annotations.SerializedName;
Expand Down
27 changes: 22 additions & 5 deletions api-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
/*
* Copyright 2021, Yurii Serhiichuk
*
* 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
*
* http://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.
*
*/

dependencies {
compile project(':api-query')
compile project(':api-common')
compile project(':api-model')
api project(':api-query')
api project(':api-common')
api project(':api-model')

compile deps.gson
compile deps.common
api deps.gson
implementation deps.common
}

appendPomDescription('Java API to access openweathermap.org API')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright 2021, Yurii Serhiichuk
*
* 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
*
* http://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.
*
*/

package org.openweathermap.api;

import com.google.gson.*;
Expand Down Expand Up @@ -53,7 +70,7 @@ public CurrentWeather getCurrentWeather(CurrentWeatherOneLocationQuery query) {
@Override
public List<CurrentWeather> getCurrentWeather(CurrentWeatherMultipleLocationsQuery query) {
String data = getWeatherData(query);
JsonObject jsonObject = jsonParser().parse(data).getAsJsonObject();
JsonObject jsonObject = JsonParser.parseString(data).getAsJsonObject();
JsonArray list = jsonObject.getAsJsonArray("list");
List<CurrentWeather> result = gson().fromJson(list, CurrentWeather.TYPE_LIST);
return result;
Expand Down Expand Up @@ -97,18 +114,6 @@ protected static Gson gson() {
return GsonHolder.INSTANCE.value;
}

protected static JsonParser jsonParser() {
return JsonParserHolder.INSTANCE.value;
}

private enum JsonParserHolder {
INSTANCE;

@SuppressWarnings({"NonSerializableFieldInSerializableClass", "ImmutableEnumChecker"})
private final JsonParser value = new JsonParser();

}

private enum GsonHolder {
INSTANCE;
@SuppressWarnings({"NonSerializableFieldInSerializableClass", "ImmutableEnumChecker"})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright 2021, Yurii Serhiichuk
*
* 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
*
* http://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.
*
*/

package org.openweathermap.api;

import org.openweathermap.api.model.currentweather.CurrentWeather;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright 2021, Yurii Serhiichuk
*
* 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
*
* http://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.
*
*/

package org.openweathermap.api;

import org.openweathermap.api.query.Query;
Expand Down
Loading

0 comments on commit b482f26

Please sign in to comment.