Skip to content
Permalink
Browse files

2.5.3.0.004: Updated readability in some files + copyright info

  • Loading branch information
iamashks committed Feb 13, 2019
1 parent ec9bf88 commit a44c34db9b0dbfe61eae67bcf663f9ef30bf5a07
Showing with 371 additions and 59 deletions.
  1. +1 −1 gradle/wrapper/gradle-wrapper.properties
  2. +1 −1 settings.gradle
  3. +1 −1 src/main/kotlin/net/aksingh/owmjapis/api/APIException.kt
  4. +1 −1 src/main/kotlin/net/aksingh/owmjapis/api/AirPollutionAPI.kt
  5. +1 −1 src/main/kotlin/net/aksingh/owmjapis/api/CurrentUVIndexAPI.kt
  6. +1 −1 src/main/kotlin/net/aksingh/owmjapis/api/CurrentWeatherAPI.kt
  7. +1 −1 src/main/kotlin/net/aksingh/owmjapis/api/DailyUVIndexForecastAPI.kt
  8. +1 −1 src/main/kotlin/net/aksingh/owmjapis/api/DailyWeatherForecastAPI.kt
  9. +1 −1 src/main/kotlin/net/aksingh/owmjapis/api/HistoricalUVIndexAPI.kt
  10. +1 −1 src/main/kotlin/net/aksingh/owmjapis/api/HourlyWeatherForecastAPI.kt
  11. +28 −5 src/main/kotlin/net/aksingh/owmjapis/core/OWM.kt
  12. +294 −5 src/main/kotlin/net/aksingh/owmjapis/core/OWMPro.kt
  13. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/AirPollution.kt
  14. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/CurrentUVIndex.kt
  15. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/CurrentWeather.kt
  16. +5 −5 src/main/kotlin/net/aksingh/owmjapis/model/CurrentWeatherList.kt
  17. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/DailyUVIndexForecast.kt
  18. +6 −6 src/main/kotlin/net/aksingh/owmjapis/model/DailyWeatherForecast.kt
  19. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/HistoricalUVIndex.kt
  20. +6 −6 src/main/kotlin/net/aksingh/owmjapis/model/HourlyWeatherForecast.kt
  21. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/AirPollutionData.kt
  22. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/City.kt
  23. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/Cloud.kt
  24. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/Coord.kt
  25. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/ForecastData.kt
  26. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/Main.kt
  27. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/Rain.kt
  28. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/Snow.kt
  29. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/System.kt
  30. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/Temp.kt
  31. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/Weather.kt
  32. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/WeatherData.kt
  33. +1 −1 src/main/kotlin/net/aksingh/owmjapis/model/param/Wind.kt
  34. +1 −1 src/main/kotlin/net/aksingh/owmjapis/util/ConversionTools.kt
  35. +1 −1 src/main/kotlin/net/aksingh/owmjapis/util/OkHttpTools.kt
  36. +1 −1 src/main/kotlin/net/aksingh/owmjapis/util/SystemTools.kt
  37. +1 −1 src/main/kotlin/net/aksingh/owmjapis/util/WeatherConditions.kt
@@ -1,5 +1,5 @@
####################################################################################################
# Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> #
# Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> #
# #
# 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 #
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -1,5 +1,5 @@
/**************************************************************************************************
* Copyright (c) 2013-2018 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* Copyright (c) 2013-2019 Ashutosh Kumar Singh <ashutosh@aksingh.net> *
* *
* 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 *
@@ -59,6 +59,7 @@ open class OWM {
private val OWM_FREE_POLLUTION_V10_BASE_URL: String = "https://api.openweathermap.org/pollution/v1/"
}

protected var retrofit4history: Retrofit
protected var retrofit4others: Retrofit
protected var retrofit4pollution: Retrofit
protected var retrofit4weather: Retrofit
@@ -118,6 +119,7 @@ open class OWM {
this.apiKey = apiKey
this.baseUrl = baseUrl

retrofit4history = createRetrofit4HistoryInstance(proxy)
retrofit4weather = createRetrofit4WeatherInstance(proxy)
retrofit4pollution = createRetrofit4PollutionInstance(proxy)
retrofit4others = createRetrofit4OthersInstance(proxy)
@@ -211,10 +213,10 @@ open class OWM {
}

@Throws(APIException::class)
fun currentWeatherByCityName(cityName: String): CurrentWeather {
fun currentWeatherByCityName(cityNameWithCountryCode: String): CurrentWeather {
val api = retrofit4weather.create(CurrentWeatherAPI::class.java)

val apiCall = api.getCurrentWeatherByCityName(cityName)
val apiCall = api.getCurrentWeatherByCityName(cityNameWithCountryCode)


val apiResp = apiCall.execute()
@@ -301,10 +303,10 @@ open class OWM {
}

@Throws(APIException::class)
fun hourlyWeatherForecastByCityName(cityName: String): HourlyWeatherForecast {
fun hourlyWeatherForecastByCityName(cityNameWithCountryCode: String): HourlyWeatherForecast {
val api = retrofit4weather.create(HourlyWeatherForecastAPI::class.java)

val apiCall = api.getHourlyWeatherForecastByCityName(cityName)
val apiCall = api.getHourlyWeatherForecastByCityName(cityNameWithCountryCode)
val apiResp = apiCall.execute()
var forecast = apiResp.body()

@@ -487,6 +489,27 @@ open class OWM {
return airPollutionByCoords(latitude, longitude, "current")
}

/**
* Init Retrofit for getting history data from OpenWeatherMap.org
*
* @param proxy Proxy
*/
protected fun createRetrofit4HistoryInstance(proxy: Proxy): Retrofit {
val clientBuilder = OkHttpClient.Builder().proxy(proxy)

OkHttpTools.addQueryParameter(clientBuilder, "appid", apiKey)

val client = clientBuilder.build()
val gson = GsonBuilder().setLenient().create()

val builder = Retrofit.Builder()
.client(client)
.baseUrl(OWMPro.OWM_PRO_V25_HISTORY_URL)
.addConverterFactory(GsonConverterFactory.create(gson))

return builder.build()
}

/**
* Init Retrofit for getting weather data from OpenWeatherMap.org
*

0 comments on commit a44c34d

Please sign in to comment.
You can’t perform that action at this time.