Cleanup before 0.9.0 release
This commit is contained in:
parent
cd83485c64
commit
1c0b71373a
9 changed files with 40 additions and 41 deletions
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [ 11, 17, 18 ]
|
||||
java-version: [ 11, 17, 20 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
2
.idea/codeStyles/codeStyleConfig.xml
generated
2
.idea/codeStyles/codeStyleConfig.xml
generated
|
@ -1,5 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
||||
</state>
|
||||
</component>
|
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.8.22" />
|
||||
<option name="version" value="1.9.10" />
|
||||
</component>
|
||||
</project>
|
24
README.md
24
README.md
|
@ -1,8 +1,8 @@
|
|||
[](https://opensource.org/licenses/BSD-3-Clause)
|
||||
[](https://kotlinlang.org/)
|
||||
[](https://kotlinlang.org/)
|
||||
[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/jokeapi/)
|
||||
[](https://github.com/ethauvin/jokeapi/releases/latest)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/jokeapi)
|
||||
[](https://central.sonatype.com/artifact/net.thauvin.erik/jokeapi)
|
||||
|
||||
[](https://sonarcloud.io/dashboard?id=ethauvin_jokeapi)
|
||||
[](https://github.com/ethauvin/jokeapi/actions/workflows/gradle.yml)
|
||||
|
@ -36,7 +36,7 @@ data class Joke(
|
|||
val lang: Language
|
||||
)
|
||||
```
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/GetJokeTest.kt#L31)...
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/GetJokeTest.kt#L64)...
|
||||
|
||||
To retrieve multiple jokes:
|
||||
|
||||
|
@ -48,7 +48,7 @@ frenchJokes.forEach {
|
|||
}
|
||||
```
|
||||
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/GetJokesTest.kt#L31)...
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/GetJokesTest.kt#L52)...
|
||||
|
||||
|
||||
If an error occurs, a `JokeException` is thrown, matching the [JokeAPI errors](https://sv443.net/jokeapi/v2/#errors):
|
||||
|
@ -74,7 +74,7 @@ class HttpErrorException(
|
|||
cause: Throwable? = null
|
||||
) : IOException(message, cause)
|
||||
```
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/ExceptionsTest.kt#L31)...
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/ExceptionsTest.kt#L57)...
|
||||
|
||||
## Java
|
||||
|
||||
|
@ -98,11 +98,11 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation("net.thauvin.erik:jokeapi:0.9-SNAPSHOT")
|
||||
implementation("net.thauvin.erik:jokeapi:0.9.0")
|
||||
}
|
||||
```
|
||||
|
||||
Instructions for using with Maven, Ivy, etc. can be found on Maven Central.
|
||||
Instructions for using with Maven, Ivy, etc. can be found on [Maven Central](https://central.sonatype.com/artifact/net.thauvin.erik/jokeapi).
|
||||
|
||||
## Raw Jokes
|
||||
|
||||
|
@ -130,7 +130,7 @@ safe: true
|
|||
lang: "en"
|
||||
|
||||
```
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/GetRawJokesTest.kt#L31)...
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/GetRawJokesTest.kt#L46)...
|
||||
|
||||
## Extending
|
||||
|
||||
|
@ -150,10 +150,4 @@ println(lang)
|
|||
error: false
|
||||
code: "fr"
|
||||
```
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/ApiCallTest.kt#L31)...
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/ApiCallTest.kt#L48)...
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.jetbrains.dokka.gradle.DokkaTask
|
|||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
id("com.github.ben-manes.versions") version "0.47.0"
|
||||
id("com.github.ben-manes.versions") version "0.48.0"
|
||||
id("io.gitlab.arturbosch.detekt") version "1.23.1"
|
||||
id("java")
|
||||
id("maven-publish")
|
||||
|
@ -15,9 +15,9 @@ plugins {
|
|||
kotlin("jvm") version "1.9.10"
|
||||
}
|
||||
|
||||
description = "Wrapper for Sv443's JokeAPI"
|
||||
description = "Retrieve jokes from Sv443's JokeAPI"
|
||||
group = "net.thauvin.erik"
|
||||
version = "0.9-SNAPSHOT"
|
||||
version = "0.9.0"
|
||||
|
||||
val deployDir = "deploy"
|
||||
val gitHub = "ethauvin/$name"
|
||||
|
@ -32,12 +32,12 @@ repositories {
|
|||
dependencies {
|
||||
implementation(platform(kotlin("bom")))
|
||||
|
||||
implementation("net.thauvin.erik:urlencoder:1.3.0")
|
||||
implementation("net.thauvin.erik.urlencoder:urlencoder-lib:1.4.0")
|
||||
implementation("org.json:json:20230618")
|
||||
|
||||
testImplementation(kotlin("test"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
||||
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.26.1")
|
||||
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.27.0")
|
||||
}
|
||||
|
||||
java {
|
||||
|
@ -126,7 +126,7 @@ tasks {
|
|||
register("deploy") {
|
||||
description = "Copies all needed files to the $deployDir directory."
|
||||
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
||||
dependsOn(clean, wrapper, build, jar)
|
||||
dependsOn(clean, build, jar)
|
||||
outputs.dir(deployDir)
|
||||
inputs.files(copyToDeploy)
|
||||
mustRunAfter(clean)
|
||||
|
|
|
@ -18,5 +18,6 @@
|
|||
<ID>MagicNumber:JokeUtil.kt$500</ID>
|
||||
<ID>MagicNumber:JokeUtil.kt$523</ID>
|
||||
<ID>TooManyFunctions:JokeConfig.kt$JokeConfig$Builder</ID>
|
||||
<ID>WildcardImport:JokeApi.kt$import net.thauvin.erik.jokeapi.models.*</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
14
pom.xml
14
pom.xml
|
@ -8,9 +8,9 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.thauvin.erik</groupId>
|
||||
<artifactId>jokeapi</artifactId>
|
||||
<version>0.9-SNAPSHOT</version>
|
||||
<version>0.9.0</version>
|
||||
<name>jokeapi</name>
|
||||
<description>Wrapper for Sv443's JokeAPI</description>
|
||||
<description>Retrieve jokes from Sv443's JokeAPI</description>
|
||||
<url>https://github.com/ethauvin/jokeapi</url>
|
||||
<licenses>
|
||||
<license>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-bom</artifactId>
|
||||
<version>1.8.22</version>
|
||||
<version>1.9.10</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -50,13 +50,13 @@
|
|||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>1.8.22</version>
|
||||
<version>1.9.10</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.thauvin.erik</groupId>
|
||||
<artifactId>urlencoder</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<groupId>net.thauvin.erik.urlencoder</groupId>
|
||||
<artifactId>urlencoder-lib-jvm</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -33,15 +33,8 @@ package net.thauvin.erik.jokeapi
|
|||
|
||||
import net.thauvin.erik.jokeapi.exceptions.HttpErrorException
|
||||
import net.thauvin.erik.jokeapi.exceptions.JokeException
|
||||
import net.thauvin.erik.jokeapi.models.Category
|
||||
import net.thauvin.erik.jokeapi.models.Flag
|
||||
import net.thauvin.erik.jokeapi.models.Format
|
||||
import net.thauvin.erik.jokeapi.models.IdRange
|
||||
import net.thauvin.erik.jokeapi.models.Joke
|
||||
import net.thauvin.erik.jokeapi.models.Language
|
||||
import net.thauvin.erik.jokeapi.models.Parameter
|
||||
import net.thauvin.erik.jokeapi.models.Type
|
||||
import net.thauvin.erik.urlencoder.UrlEncoder
|
||||
import net.thauvin.erik.jokeapi.models.*
|
||||
import net.thauvin.erik.urlencoder.UrlEncoderUtil
|
||||
import org.json.JSONObject
|
||||
import java.util.logging.Logger
|
||||
import java.util.stream.Collectors
|
||||
|
@ -85,7 +78,7 @@ object JokeApi {
|
|||
val param = it.next()
|
||||
urlBuilder.append(param.key)
|
||||
if (param.value.isNotEmpty()) {
|
||||
urlBuilder.append("=").append(UrlEncoder.encode(param.value))
|
||||
urlBuilder.append("=").append(UrlEncoderUtil.encode(param.value))
|
||||
}
|
||||
if (it.hasNext()) {
|
||||
urlBuilder.append("&")
|
||||
|
|
|
@ -36,6 +36,7 @@ import assertk.assertions.isGreaterThan
|
|||
import assertk.assertions.startsWith
|
||||
import net.thauvin.erik.jokeapi.JokeApi.apiCall
|
||||
import net.thauvin.erik.jokeapi.models.Format
|
||||
import net.thauvin.erik.jokeapi.models.Language
|
||||
import net.thauvin.erik.jokeapi.models.Parameter
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions.assertFalse
|
||||
|
@ -73,4 +74,14 @@ internal class ApiCallTest {
|
|||
val ping = apiCall(endPoint = "ping", params = mapOf(Parameter.FORMAT to Format.TXT.value))
|
||||
assertThat(ping, "apiCall(ping, txt)").startsWith("Pong!")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Get Supported Language`() {
|
||||
// See https://v2.jokeapi.dev/languages
|
||||
val lang = apiCall(
|
||||
endPoint = "languages",
|
||||
params = mapOf(Parameter.FORMAT to Format.XML.value, Parameter.LANG to Language.FR.value)
|
||||
)
|
||||
assertThat(lang).startsWith("<?xml version='1.0'?>")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue