diff --git a/.circleci/config.yml b/.circleci/config.yml
index c781fdc..edab9fe 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,62 +1,53 @@
-version: 2.1
-
-orbs:
- sdkman: joshdholtz/sdkman@0.2.0
-
+version: 2
defaults: &defaults
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
- CI_NAME: "CircleCI"
-
-commands:
- build_and_test:
- parameters:
- reports-dir:
- type: string
- default: "build/reports/test_results"
- steps:
- - checkout
- - sdkman/setup-sdkman
- - sdkman/sdkman-install:
- candidate: kotlin
- version: 2.1.10
- - run:
- name: Download dependencies
- command: ./bld download
- - run:
- name: Compile source
- command: ./bld compile
- - run:
- name: Run tests
- command: ./bld jacoco -reports-dir=<< parameters.reports-dir >>
- - store_test_results:
- path: << parameters.reports-dir >>
- - store_artifacts:
- path: build/reports/jacoco/test/html
+ CI: true
+defaults_gradle: &defaults_gradle
+ steps:
+ - checkout
+ - restore_cache:
+ keys:
+ - gradle-dependencies-{{ checksum "build.gradle.kts" }}
+ # fallback to using the latest cache if no exact match is found
+ - gradle-dependencies-
+ - run:
+ name: Gradle Dependencies
+ command: ./gradlew dependencies
+ - save_cache:
+ paths: ~/.m2
+ key: gradle-dependencies-{{ checksum "build.gradle.kts" }}
+ - run:
+ name: Run All Checks
+ command: ./gradlew check
+ - store_artifacts:
+ path: build/reports/
+ destination: reports
+ - store_test_results:
+ path: build/reports/
jobs:
- bld_jdk17:
+ build_gradle_jdk18:
<<: *defaults
docker:
- - image: cimg/openjdk:17.0
+ - image: cimg/openjdk:18.0
- steps:
- - build_and_test
+ <<: *defaults_gradle
- bld_jdk21:
+ build_gradle_jdk11:
<<: *defaults
docker:
- - image: cimg/openjdk:21.0
+ - image: cimg/openjdk:11.0
- steps:
- - build_and_test
+ <<: *defaults_gradle
workflows:
- bld:
+ version: 2
+ gradle:
jobs:
- - bld_jdk17
- - bld_jdk21
+ - build_gradle_jdk11
+ - build_gradle_jdk18
diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml
deleted file mode 100644
index 2f03292..0000000
--- a/.github/workflows/bld.yml
+++ /dev/null
@@ -1,68 +0,0 @@
-name: bld-ci
-
-on: [ push, pull_request, workflow_dispatch ]
-
-env:
- COVERAGE_JDK: "21"
- COVERAGE_KOTLIN: "2.1.20"
-
-jobs:
- build-bld-project:
- strategy:
- matrix:
- java-version: [ 17, 21, 24 ]
- kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ]
- os: [ ubuntu-latest, windows-latest, macos-latest ]
-
- runs-on: ${{ matrix.os }}
-
- steps:
- - name: Checkout source repository
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Set up JDK ${{ matrix.java-version }} with Kotlin ${{ matrix.kotlin-version }}
- uses: actions/setup-java@v4
- with:
- distribution: "zulu"
- java-version: ${{ matrix.java-version }}
-
- - name: Download dependencies [bld example]
- working-directory: examples/bld
- run: ./bld download
-
- - name: Compile and run examples [bld example]
- working-directory: examples/bld
- run: |
- ./bld compile
- ./bld run
- ./bld run-java
-
- - name: Run examples [gradle example]
- working-directory: examples/gradle
- run: |
- ./gradlew run
- ./gradlew runJava
-
- - name: Download dependencies
- run: ./bld download
-
- - name: Compile source
- run: ./bld compile
-
- - name: Run tests
- run: ./bld jacoco
-
- - name: Remove pom.xml
- if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
- && matrix.os == 'ubuntu-latest'
- run: rm -rf pom.xml
-
- - name: SonarCloud Scan
- uses: sonarsource/sonarcloud-github-action@master
- if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
- && matrix.os == 'ubuntu-latest'
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
new file mode 100644
index 0000000..a1e879d
--- /dev/null
+++ b/.github/workflows/gradle.yml
@@ -0,0 +1,49 @@
+name: gradle-ci
+
+on: [ push, pull_request, workflow_dispatch ]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ env:
+ GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
+ SONAR_JDK: "11"
+
+ strategy:
+ matrix:
+ java-version: [ 11, 18 ]
+
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up JDK ${{ matrix.java-version }}
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java-version }}
+
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+
+ - name: Cache SonarCloud packages
+ if: matrix.java-version == env.SONAR_JDK
+ uses: actions/cache@v3
+ with:
+ path: ~/.sonar/cache
+ key: ${{ runner.os }}-sonar
+ restore-keys: ${{ runner.os }}-sonar
+
+ - name: Test with Gradle
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build check --stacktrace
+
+ - name: SonarCloud
+ if: success() && matrix.java-version == env.SONAR_JDK
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: ./gradlew sonar --info
diff --git a/.gitignore b/.gitignore
index ea86fe8..0742f86 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,57 +1,84 @@
-.gradle
+!.vscode/extensions.json
+!.vscode/launch.json
+!.vscode/settings.json
+!.vscode/tasks.json
+*.class
+*.code-workspace
+*.ctxt
+*.iws
+*.log
+*.nar
+*.rar
+*.sublime-*
+*.tar.gz
+*.zip
.DS_Store
-build
-lib/bld/**
-!lib/bld/bld-wrapper.jar
-!lib/bld/bld-wrapper.properties
-lib/compile/
-lib/runtime/
-lib/standalone/
-lib/test/
-
-# IDEA ignores
-
-# User-specific
-.idea/**/workspace.xml
-.idea/**/tasks.xml
-.idea/**/usage.statistics.xml
-.idea/**/dictionaries
-.idea/**/shelf
-
-# AWS User-specific
-.idea/**/aws.xml
-
-# Generated files
-.idea/**/contentModel.xml
-
-# Sensitive or high-churn files
-.idea/**/dataSources/
-.idea/**/dataSources.ids
-.idea/**/dataSources.local.xml
-.idea/**/sqlDataSources.xml
-.idea/**/dynamic.xml
-.idea/**/uiDesigner.xml
-.idea/**/dbnavigator.xml
-
-# Gradle
-.idea/**/gradle.xml
-
-# Mongo Explorer plugin
-.idea/**/mongoSettings.xml
-
-# mpeltonen/sbt-idea plugin
-.idea_modules/
-
-# JIRA plugin
+.classpath
+.gradle
+.history
+.kobalt
+.mtj.tmp/
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+.nb-gradle
+.project
+.scannerwork
+.settings
+.vscode/*
+/**/.idea/$CACHE_FILE$
+/**/.idea/$PRODUCT_WORKSPACE_FILE$
+/**/.idea/**/caches/build_file_checksums.ser
+/**/.idea/**/contentModel.xml
+/**/.idea/**/dataSources.ids
+/**/.idea/**/dataSources.local.xml
+/**/.idea/**/dataSources/
+/**/.idea/**/dbnavigator.xml
+/**/.idea/**/dictionaries
+/**/.idea/**/dynamic.xml
+/**/.idea/**/gradle.xml
+/**/.idea/**/httpRequests
+/**/.idea/**/libraries
+/**/.idea/**/mongoSettings.xml
+/**/.idea/**/replstate.xml
+/**/.idea/**/shelf
+/**/.idea/**/shelf/
+/**/.idea/**/sqlDataSources.xml
+/**/.idea/**/tasks.xml
+/**/.idea/**/uiDesigner.xml
+/**/.idea/**/usage.statistics.xml
+/**/.idea/**/workspace.xml
+/**/.idea/sonarlint*
+/**/.idea_modules/
+Thumbs.db
+__pycache__
atlassian-ide-plugin.xml
-
-# Cursive Clojure plugin
-.idea/replstate.xml
-
-# SonarLint plugin
-.idea/sonarlint/
-
-# Editor-based Rest Client
-.idea/httpRequests
-
+bin/
+build/
+cmake-build-*/
+com_crashlytics_export_strings.xml
+crashlytics-build.properties
+crashlytics.properties
+dependency-reduced-pom.xml
+deploy/
+dist/
+ehthumbs.db
+fabric.properties
+gen/
+hs_err_pid*
+kobaltBuild
+kobaltw*-test
+lib/kotlin*
+libs/
local.properties
+out/
+pom.xml.asc
+pom.xml.next
+pom.xml.releaseBackup
+pom.xml.tag
+pom.xml.versionsBackup
+proguard-project.txt
+project.properties
+release.properties
+target/
+test-output
+venv
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 10b9b0f..1a3e8b4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,24 +1,31 @@
-image: fedora:latest
+image: gradle:8-jdk11
variables:
- CI_NAME: "GitLab CI"
-
-stages:
- - test
+ GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- - dnf -qy update && dnf -y install zip
- - curl -s "https://get.sdkman.io" | bash
- - echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
- - echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
- - source "$HOME/.sdkman/bin/sdkman-init.sh"
- - sdk install java
- - sdk install kotlin
- - source "$HOME/.sdkman/bin/sdkman-init.sh"
+ - export GRADLE_USER_HOME=`pwd`/.gradle
+
+stages:
+ - build
+ - test
+
+build:
+ stage: build
+ script: gradle --build-cache assemble
+ cache:
+ key: "$CI_COMMIT_REF_NAME"
+ policy: push
+ paths:
+ - build
+ - .gradle
test:
stage: test
- script:
- - ./bld download
- - ./bld compile
- - ./bld test
+ script: gradle check
+ cache:
+ key: "$CI_COMMIT_REF_NAME"
+ policy: pull
+ paths:
+ - build
+ - .gradle
diff --git a/.idea/app.iml b/.idea/app.iml
deleted file mode 100644
index 9e43636..0000000
--- a/.idea/app.iml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/bld.iml b/.idea/bld.iml
deleted file mode 100644
index e63e11e..0000000
--- a/.idea/bld.iml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/bld.xml b/.idea/bld.xml
deleted file mode 100644
index 6600cee..0000000
--- a/.idea/bld.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 6b3d5a0..562d6ca 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -32,49 +32,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/intellij-javadocs-4.0.1.xml b/.idea/intellij-javadocs-4.0.1.xml
deleted file mode 100644
index d3e96f9..0000000
--- a/.idea/intellij-javadocs-4.0.1.xml
+++ /dev/null
@@ -1,204 +0,0 @@
-
-
-
-
- UPDATE
- false
- true
-
- TYPE
- METHOD
- FIELD
-
-
- DEFAULT
- PUBLIC
- PROTECTED
-
-
-
-
-
- ^.*(public|protected|private)*.+interface\s+\w+.*
- /**\n
- * The interface ${name}.\n
-<#if element.typeParameters?has_content> * \n
-</#if>
-<#list element.typeParameters as typeParameter>
- * @param <${typeParameter.name}> the type parameter\n
-</#list>
- */
-
-
- ^.*(public|protected|private)*.+enum\s+\w+.*
- /**\n
- * The enum ${name}.\n
- */
-
-
- ^.*(public|protected|private)*.+class\s+\w+.*
- /**\n
- * The type ${name}.\n
-<#if element.typeParameters?has_content> * \n
-</#if>
-<#list element.typeParameters as typeParameter>
- * @param <${typeParameter.name}> the type parameter\n
-</#list>
- */
-
-
- .+
- /**\n
- * The type ${name}.\n
- */
-
-
-
-
- .+
- /**\n
- * Instantiates a new ${name}.\n
-<#if element.parameterList.parameters?has_content>
- *\n
-</#if>
-<#list element.parameterList.parameters as parameter>
- * @param ${parameter.name} the ${paramNames[parameter.name]}\n
-</#list>
-<#if element.throwsList.referenceElements?has_content>
- *\n
-</#if>
-<#list element.throwsList.referenceElements as exception>
- * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
-</#list>
- */
-
-
-
-
- ^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+
- /**\n
- * Gets ${partName}.\n
-<#if element.typeParameters?has_content> * \n
-</#if>
-<#list element.typeParameters as typeParameter>
- * @param <${typeParameter.name}> the type parameter\n
-</#list>
-<#if element.parameterList.parameters?has_content>
- *\n
-</#if>
-<#list element.parameterList.parameters as parameter>
- * @param ${parameter.name} the ${paramNames[parameter.name]}\n
-</#list>
-<#if isNotVoid>
- *\n
- * @return the ${partName}\n
-</#if>
-<#if element.throwsList.referenceElements?has_content>
- *\n
-</#if>
-<#list element.throwsList.referenceElements as exception>
- * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
-</#list>
- */
-
-
- ^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+
- /**\n
- * Sets ${partName}.\n
-<#if element.typeParameters?has_content> * \n
-</#if>
-<#list element.typeParameters as typeParameter>
- * @param <${typeParameter.name}> the type parameter\n
-</#list>
-<#if element.parameterList.parameters?has_content>
- *\n
-</#if>
-<#list element.parameterList.parameters as parameter>
- * @param ${parameter.name} the ${paramNames[parameter.name]}\n
-</#list>
-<#if isNotVoid>
- *\n
- * @return the ${partName}\n
-</#if>
-<#if element.throwsList.referenceElements?has_content>
- *\n
-</#if>
-<#list element.throwsList.referenceElements as exception>
- * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
-</#list>
- */
-
-
- ^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+
- /**\n
- * The entry point of application.\n
-
- <#if element.parameterList.parameters?has_content>
- *\n
-</#if>
- * @param ${element.parameterList.parameters[0].name} the input arguments\n
-<#if element.throwsList.referenceElements?has_content>
- *\n
-</#if>
-<#list element.throwsList.referenceElements as exception>
- * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
-</#list>
- */
-
-
- .+
- /**\n
- * ${name}<#if isNotVoid> ${return}</#if>.\n
-<#if element.typeParameters?has_content> * \n
-</#if>
-<#list element.typeParameters as typeParameter>
- * @param <${typeParameter.name}> the type parameter\n
-</#list>
-<#if element.parameterList.parameters?has_content>
- *\n
-</#if>
-<#list element.parameterList.parameters as parameter>
- * @param ${parameter.name} the ${paramNames[parameter.name]}\n
-</#list>
-<#if isNotVoid>
- *\n
- * @return the ${return}\n
-</#if>
-<#if element.throwsList.referenceElements?has_content>
- *\n
-</#if>
-<#list element.throwsList.referenceElements as exception>
- * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
-</#list>
- */
-
-
-
-
- ^.*(public|protected|private)*.+static.*(\w\s\w)+.+
- /**\n
- * The constant ${element.getName()}.\n
- */
-
-
- ^.*(public|protected|private)*.*(\w\s\w)+.+
- /**\n
- <#if element.parent.isInterface()>
- * The constant ${element.getName()}.\n
-<#else>
- * The ${name}.\n
-</#if> */
-
-
- .+
- /**\n
- <#if element.parent.isEnum()>
- *${name} ${typeName}.\n
-<#else>
- * The ${name}.\n
-</#if>*/
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index 031f228..f8467b4 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,16 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml
deleted file mode 100644
index 153a060..0000000
--- a/.idea/libraries/bld.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.idea/libraries/compile.xml b/.idea/libraries/compile.xml
deleted file mode 100644
index 99cc0c0..0000000
--- a/.idea/libraries/compile.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/runtime.xml b/.idea/libraries/runtime.xml
deleted file mode 100644
index d4069f2..0000000
--- a/.idea/libraries/runtime.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/test.xml b/.idea/libraries/test.xml
deleted file mode 100644
index 57ed5ef..0000000
--- a/.idea/libraries/test.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index c5c96e1..3d0bb47 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,17 +1,10 @@
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 55adcb9..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
index e7f7d47..194661d 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright 2021-2025 Erik C. Thauvin (erik@thauvin.net)
+Copyright 2021-2023 Erik C. Thauvin (erik@thauvin.net)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
diff --git a/README.md b/README.md
index d36883b..ed92e08 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,16 @@
[](https://opensource.org/licenses/BSD-3-Clause)
-[](https://kotlinlang.org/)
-[](https://rife2.com/bld)
+[](https://kotlinlang.org/)
+[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/cryptoprice/)
[](https://github.com/ethauvin/cryptoprice/releases/latest)
[](https://central.sonatype.com/artifact/net.thauvin.erik/cryptoprice)
-[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/cryptoprice/)
[](https://sonarcloud.io/dashboard?id=ethauvin_cryptoprice)
-[](https://github.com/ethauvin/cryptoprice/actions/workflows/bld.yml)
+[](https://github.com/ethauvin/cryptoprice/actions/workflows/gradle.yml)
[](https://circleci.com/gh/ethauvin/cryptoprice/tree/master)
# Retrieve cryptocurrencies current (buy, sell or spot) prices
-A simple implementation of the prices [Coinbase Public API](https://docs.cdp.coinbase.com/coinbase-app/docs/api-prices).
+A simple implementation of the prices [Coinbase Public API](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices).
## Examples (TL;DR)
@@ -30,23 +29,11 @@ val eth = buyPrice("LTC", "GBP") // Litecoin in Pound sterling
println(eth.amount)
```
- - View [bld](https://github.com/ethauvin/cryptoprice/blob/master/examples/bld) or [Gradle](https://github.com/ethauvin/cryptoprice/blob/master/examples/gradle) Examples.
-
-### bld
-
-To use with [bld](https://rife2.com/bld), include the following dependency in your [build](https://github.com/ethauvin/cryptoprice/blob/master/examples/bld/src/bld/java/com/example/CryptoPriceExampleBuild.java) file:
-
-```java
-repositories = List.of(MAVEN_CENTRAL);
-
-scope(compile)
- .include(dependency("net.thauvin.erik:cryptoprice:1.0.2"));
-```
-Be sure to use the [bld Kotlin extension](https://github.com/rife2/bld-kotlin) in your project.
+ - View [Kotlin](https://github.com/ethauvin/cryptoprice/blob/master/examples/src/main/kotlin/com/example/CryptoPriceExample.kt) or [Java](https://github.com/ethauvin/cryptoprice/blob/master/examples/src/main/java/com/example/CryptoPriceSample.java) Examples.
### Gradle, Maven, etc.
-To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/cryptoprice/blob/master/examples/gradle/build.gradle.kts) file:
+To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/cryptoprice/blob/master/examples/build.gradle.kts) file:
```gradle
repositories {
@@ -55,7 +42,7 @@ repositories {
}
dependencies {
- implementation("net.thauvin.erik:cryptoprice:1.0.2")
+ implementation("net.thauvin.erik:cryptoprice:1.0.1")
}
```
@@ -94,7 +81,7 @@ A `CryptoPrice` object is returned defined as follows:
```kotlin
CryptoPrice(val base: String, val currency: String, val amount: BigDecimal)
```
-The parameter names match the [Coinbase API](https://docs.cdp.coinbase.com/coinbase-app/docs/api-prices).
+The parameter names match the [Coinbase API](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices).
#### Format
@@ -123,7 +110,7 @@ println(price.toJson())
{"data":{"base":"BTC","currency":"USD","amount":"34567.89"}}
```
-The `data` object matches the [Coinbase API](https://docs.cdp.coinbase.com/coinbase-app/docs/api-prices). To specify a different (or no) key, use:
+The `data` object matches the [Coinbase API](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices). To specify a different (or no) key, use:
```kotlin
println(price.toJson("bitcoin"))
@@ -146,7 +133,7 @@ val eth = """{"ether":{"base":"ETH","currency":"USD","amount":"2345.67"}}""".toP
### Extending
-A generic `apiCall()` function is available to access other [data API endpoints](https://docs.cdp.coinbase.com/coinbase-app/docs/api-currencies). For example to retrieve the [exchange rates](https://docs.cdp.coinbase.com/coinbase-app/docs/api-exchange-rates):
+A generic `apiCall()` function is available to access other [data API endpoints](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies). For example to retrieve the [exchange rates](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates):
```kotlin
apiCall(listOf("exchange-rates"), mapOf("currency" to "usd"))
@@ -158,22 +145,3 @@ will return something like:
```
See the [examples](https://github.com/ethauvin/cryptoprice/blob/master/examples/) for more details.
-
-## Contributing
-
-If you want to contribute to this project, all you have to do is clone the GitHub
-repository:
-
-```console
-git clone git@github.com:ethauvin/cryptoprice.git
-```
-
-Then use [bld](https://rife2.com/bld) to build:
-
-```console
-cd cryptoprice
-./bld compile
-```
-
-The project has an [IntelliJ IDEA](https://www.jetbrains.com/idea/) project structure. You can just open it after all
-the dependencies were downloaded and peruse the code.
diff --git a/baseline.xml b/baseline.xml
new file mode 100644
index 0000000..c4d9ac8
--- /dev/null
+++ b/baseline.xml
@@ -0,0 +1,8 @@
+
+
+
+
+ ThrowsCount:CryptoPrice.kt$CryptoPrice.Companion$ @JvmStatic @JvmOverloads @Throws(CryptoException::class, IOException::class) fun apiCall(paths: List<String>, params: Map<String, String> = emptyMap()): String
+ ThrowsCount:CryptoPrice.kt$CryptoPrice.Companion$@JvmStatic @Throws(CryptoException::class) fun String.toPrice(): CryptoPrice
+
+
diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml
index ace99d2..a9514a0 100644
--- a/bitbucket-pipelines.yml
+++ b/bitbucket-pipelines.yml
@@ -1,20 +1,9 @@
-image: ubuntu:latest
+image: maven:3-openjdk-18
pipelines:
default:
- step:
- name: Test with bld
+ caches:
+ - gradle
script:
- # Install latest Java & Kotlin via SDKMAN!
- - apt-get update -qq && apt-get install -y curl zip
- - curl -s "https://get.sdkman.io" | bash
- - echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
- - echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
- - source "$HOME/.sdkman/bin/sdkman-init.sh"
- - sdk install java
- - sdk install kotlin
- - source "$HOME/.sdkman/bin/sdkman-init.sh"
- # Download, compile and test with bld
- - ./bld download
- - ./bld compile
- - ./bld test
+ - bash ./gradlew check
diff --git a/bld b/bld
deleted file mode 100755
index 07e7ae2..0000000
--- a/bld
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env sh
-java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.crypto.CryptoPriceBuild "$@"
\ No newline at end of file
diff --git a/bld.bat b/bld.bat
deleted file mode 100644
index c55b623..0000000
--- a/bld.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo off
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.crypto.CryptoPriceBuild %*
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..a4ae3cd
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,211 @@
+import org.jetbrains.dokka.gradle.DokkaTask
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
+import org.gradle.api.tasks.testing.logging.TestExceptionFormat
+import org.gradle.api.tasks.testing.logging.TestLogEvent
+
+
+plugins {
+ id("application")
+ id("com.github.ben-manes.versions") version "0.48.0"
+ id("io.gitlab.arturbosch.detekt") version "1.23.1"
+ id("java")
+ id("maven-publish")
+ id("org.jetbrains.dokka") version "1.9.0"
+ id("org.jetbrains.kotlinx.kover") version "0.7.3"
+ id("org.sonarqube") version "4.3.1.3277"
+ id("signing")
+ kotlin("jvm") version "1.9.10"
+}
+
+defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
+
+description = "Retrieve cryptocurrencies prices"
+group = "net.thauvin.erik"
+version = "1.0.1"
+
+val deployDir = "deploy"
+val gitHub = "ethauvin/$name"
+val mavenUrl = "https://github.com/$gitHub"
+val publicationName = "mavenJava"
+
+fun isNonStable(version: String): Boolean {
+ val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
+ val regex = "^[0-9,.v-]+(-r)?$".toRegex()
+ val isStable = stableKeyword || regex.matches(version)
+ return isStable.not()
+}
+
+repositories {
+ mavenCentral()
+ maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
+}
+
+dependencies {
+ implementation(platform(kotlin("bom")))
+ implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
+
+ implementation("com.squareup.okhttp3:okhttp:4.11.0")
+ implementation("org.json:json:20230618")
+
+ testImplementation(kotlin("test"))
+ testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.27.0")
+}
+
+application {
+ mainClass.set("net.thauvin.erik.crypto.CryptoPrice")
+}
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ withSourcesJar()
+}
+
+detekt {
+ //toolVersion = "main-SNAPSHOT"
+}
+
+koverReport {
+ defaults {
+ xml {
+ onCheck = true
+ }
+ html {
+ onCheck = true
+ }
+ }
+}
+
+sonarqube {
+ properties {
+ property("sonar.projectKey", "ethauvin_$name")
+ property("sonar.organization", "ethauvin-github")
+ property("sonar.host.url", "https://sonarcloud.io")
+ property("sonar.sourceEncoding", "UTF-8")
+ property("sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/kover/report.xml")
+ }
+}
+
+val javadocJar by tasks.creating(Jar::class) {
+ dependsOn(tasks.dokkaJavadoc)
+ from(tasks.dokkaJavadoc)
+ archiveClassifier.set("javadoc")
+}
+
+tasks {
+ named("run") {
+ args = listOf("BTC","ETH","LTC")
+ }
+
+ withType {
+ rejectVersionIf {
+ isNonStable(candidate.version)
+ }
+ }
+
+ withType().configureEach {
+ kotlinOptions.jvmTarget = java.targetCompatibility.toString()
+ }
+
+ withType {
+ testLogging {
+ exceptionFormat = TestExceptionFormat.FULL
+ events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
+ }
+ }
+
+ withType().configureEach {
+ this.jvmTarget = java.targetCompatibility.toString()
+ }
+
+ withType().configureEach {
+ this.jvmTarget = java.targetCompatibility.toString()
+ }
+
+ withType {
+ destination = file("$projectDir/pom.xml")
+ }
+
+ clean {
+ doLast {
+ project.delete(fileTree(deployDir))
+ }
+ }
+
+ withType().configureEach {
+ dokkaSourceSets {
+ named("main") {
+ moduleName.set("CryptoPrice")
+ }
+ }
+ }
+
+ val copyToDeploy by registering(Copy::class) {
+ from(configurations.runtimeClasspath) {
+ exclude("annotations-*.jar")
+ }
+ from(jar)
+ into(deployDir)
+ }
+
+ register("deploy") {
+ description = "Copies all needed files to the $deployDir directory."
+ group = PublishingPlugin.PUBLISH_TASK_GROUP
+ dependsOn(clean, wrapper, build, jar)
+ outputs.dir(deployDir)
+ inputs.files(copyToDeploy)
+ mustRunAfter(clean)
+ }
+}
+
+publishing {
+ publications {
+ create(publicationName) {
+ from(components["java"])
+ artifact(javadocJar)
+ pom {
+ name.set(project.name)
+ description.set(project.description)
+ url.set(mavenUrl)
+ licenses {
+ license {
+ name.set("BSD 3-Clause")
+ url.set("https://opensource.org/licenses/BSD-3-Clause")
+ }
+ }
+ developers {
+ developer {
+ id.set("ethauvin")
+ name.set("Erik C. Thauvin")
+ email.set("erik@thauvin.net")
+ url.set("https://erik.thauvin.net/")
+ }
+ }
+ scm {
+ connection.set("scm:git:https://github.com/$gitHub.git")
+ developerConnection.set("scm:git:git@github.com:$gitHub.git")
+ url.set(mavenUrl)
+ }
+ issueManagement {
+ system.set("GitHub")
+ url.set("$mavenUrl/issues")
+ }
+ }
+ }
+ }
+ repositories {
+ maven {
+ name = "ossrh"
+ url = if (project.version.toString().contains("SNAPSHOT"))
+ uri("https://oss.sonatype.org/content/repositories/snapshots/") else
+ uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
+ credentials(PasswordCredentials::class)
+ }
+ }
+}
+
+signing {
+ useGpgCmd()
+ sign(publishing.publications[publicationName])
+}
diff --git a/examples/gradle/.gitattributes b/examples/.gitattributes
similarity index 100%
rename from examples/gradle/.gitattributes
rename to examples/.gitattributes
diff --git a/examples/gradle/.gitignore b/examples/.gitignore
similarity index 95%
rename from examples/gradle/.gitignore
rename to examples/.gitignore
index 44369dd..1b6985c 100644
--- a/examples/gradle/.gitignore
+++ b/examples/.gitignore
@@ -3,5 +3,3 @@
# Ignore Gradle build output directory
build
-
-bin
diff --git a/examples/bld/.gitignore b/examples/bld/.gitignore
deleted file mode 100644
index a2805aa..0000000
--- a/examples/bld/.gitignore
+++ /dev/null
@@ -1,55 +0,0 @@
-.gradle
-.DS_Store
-build
-lib/bld/**
-!lib/bld/bld-wrapper.jar
-!lib/bld/bld-wrapper.properties
-lib/compile/
-lib/runtime/
-lib/standalone/
-lib/test/
-
-# IDEA ignores
-
-# User-specific
-.idea/**/workspace.xml
-.idea/**/tasks.xml
-.idea/**/usage.statistics.xml
-.idea/**/dictionaries
-.idea/**/shelf
-
-# AWS User-specific
-.idea/**/aws.xml
-
-# Generated files
-.idea/**/contentModel.xml
-
-# Sensitive or high-churn files
-.idea/**/dataSources/
-.idea/**/dataSources.ids
-.idea/**/dataSources.local.xml
-.idea/**/sqlDataSources.xml
-.idea/**/dynamic.xml
-.idea/**/uiDesigner.xml
-.idea/**/dbnavigator.xml
-
-# Gradle
-.idea/**/gradle.xml
-
-# Mongo Explorer plugin
-.idea/**/mongoSettings.xml
-
-# mpeltonen/sbt-idea plugin
-.idea_modules/
-
-# JIRA plugin
-atlassian-ide-plugin.xml
-
-# Cursive Clojure plugin
-.idea/replstate.xml
-
-# SonarLint plugin
-.idea/sonarlint/
-
-# Editor-based Rest Client
-.idea/httpRequests
\ No newline at end of file
diff --git a/examples/bld/.idea/.gitignore b/examples/bld/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/examples/bld/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/examples/bld/.idea/.name b/examples/bld/.idea/.name
deleted file mode 100644
index cb96006..0000000
--- a/examples/bld/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-cryptoprice-examples-bld
\ No newline at end of file
diff --git a/examples/bld/.idea/app.iml b/examples/bld/.idea/app.iml
deleted file mode 100644
index c3d8915..0000000
--- a/examples/bld/.idea/app.iml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/bld.iml b/examples/bld/.idea/bld.iml
deleted file mode 100644
index e63e11e..0000000
--- a/examples/bld/.idea/bld.iml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/bld.xml b/examples/bld/.idea/bld.xml
deleted file mode 100644
index 6600cee..0000000
--- a/examples/bld/.idea/bld.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/inspectionProfiles/Project_Default.xml b/examples/bld/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 1e01b48..0000000
--- a/examples/bld/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/bld.xml b/examples/bld/.idea/libraries/bld.xml
deleted file mode 100644
index af4608e..0000000
--- a/examples/bld/.idea/libraries/bld.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/compile.xml b/examples/bld/.idea/libraries/compile.xml
deleted file mode 100644
index 99cc0c0..0000000
--- a/examples/bld/.idea/libraries/compile.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/runtime.xml b/examples/bld/.idea/libraries/runtime.xml
deleted file mode 100644
index d4069f2..0000000
--- a/examples/bld/.idea/libraries/runtime.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/test.xml b/examples/bld/.idea/libraries/test.xml
deleted file mode 100644
index 57ed5ef..0000000
--- a/examples/bld/.idea/libraries/test.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/misc.xml b/examples/bld/.idea/misc.xml
deleted file mode 100644
index d0c8b16..0000000
--- a/examples/bld/.idea/misc.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/modules.xml b/examples/bld/.idea/modules.xml
deleted file mode 100644
index 55adcb9..0000000
--- a/examples/bld/.idea/modules.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/runConfigurations/Run Tests.xml b/examples/bld/.idea/runConfigurations/Run Tests.xml
deleted file mode 100644
index 2b503e5..0000000
--- a/examples/bld/.idea/runConfigurations/Run Tests.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.idea/vcs.xml b/examples/bld/.idea/vcs.xml
deleted file mode 100644
index b2bdec2..0000000
--- a/examples/bld/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/bld/.vscode/launch.json b/examples/bld/.vscode/launch.json
deleted file mode 100644
index 30a8889..0000000
--- a/examples/bld/.vscode/launch.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "version": "0.2.0",
- "configurations": [
- {
- "type": "java",
- "name": "Run Tests",
- "request": "launch",
- "mainClass": "com.example.ExampleTest"
- }
- ]
-}
diff --git a/examples/bld/.vscode/settings.json b/examples/bld/.vscode/settings.json
deleted file mode 100644
index ba429d0..0000000
--- a/examples/bld/.vscode/settings.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "java.project.sourcePaths": [
- "src/main/java",
- "src/main/resources",
- "src/test/java",
- "src/test/resources",
- "src/bld/java",
- "src/bld/resources"
- ],
- "java.configuration.updateBuildConfiguration": "automatic",
- "java.project.referencedLibraries": [
- "${HOME}/.bld/dist/bld-2.2.1.jar",
- "lib/**/*.jar"
- ]
-}
diff --git a/examples/bld/README.md b/examples/bld/README.md
deleted file mode 100644
index 1475694..0000000
--- a/examples/bld/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-## Kotlin Example
-To compile & run the Kotlin example:
-
-```console
-./bld compile
-
-./bld run
-./bld run --args="btc"
-./bld run --args="eth eur"
-```
-
-## Java Example
-
-To compile & run the Java example:
-
-```console
-./bld compile
-
-./bld run-java
-./bld run-java --args="btc"
-./bld run-java --args="eth eur"
-```
diff --git a/examples/bld/bld b/examples/bld/bld
deleted file mode 100755
index 990ba40..0000000
--- a/examples/bld/bld
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env sh
-java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build com.example.CryptoPriceExampleBuild "$@"
\ No newline at end of file
diff --git a/examples/bld/bld.bat b/examples/bld/bld.bat
deleted file mode 100644
index 1c1f800..0000000
--- a/examples/bld/bld.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo off
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build com.example.CryptoPriceExampleBuild %*
\ No newline at end of file
diff --git a/examples/bld/lib/bld/bld-wrapper.jar b/examples/bld/lib/bld/bld-wrapper.jar
deleted file mode 100644
index ed508a4..0000000
Binary files a/examples/bld/lib/bld/bld-wrapper.jar and /dev/null differ
diff --git a/examples/bld/lib/bld/bld-wrapper.properties b/examples/bld/lib/bld/bld-wrapper.properties
deleted file mode 100644
index 1f1009d..0000000
--- a/examples/bld/lib/bld/bld-wrapper.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-bld.downloadExtensionJavadoc=false
-bld.downloadExtensionSources=true
-bld.downloadLocation=
-bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
-bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
-bld.sourceDirectories=
-bld.version=2.2.1
diff --git a/examples/bld/src/bld/java/com/example/CryptoPriceExampleBuild.java b/examples/bld/src/bld/java/com/example/CryptoPriceExampleBuild.java
deleted file mode 100644
index ca79523..0000000
--- a/examples/bld/src/bld/java/com/example/CryptoPriceExampleBuild.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.example;
-
-import rife.bld.BuildCommand;
-import rife.bld.extension.CompileKotlinOperation;
-import rife.bld.operations.RunOperation;
-import rife.bld.BaseProject;
-
-import java.util.List;
-
-import static rife.bld.dependencies.Repository.*;
-import static rife.bld.dependencies.Scope.compile;
-
-public class CryptoPriceExampleBuild extends BaseProject {
- public CryptoPriceExampleBuild() {
- pkg = "com.example";
- name = "Example";
- version = version(0, 1, 0);
-
- mainClass = "com.example.CryptoPriceExampleKt";
-
- javaRelease = 11;
- downloadSources = true;
-
- autoDownloadPurge = true;
- repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY);
-
- scope(compile)
- .include(dependency("net.thauvin.erik", "cryptoprice", version(1, 0, 3, "SNAPSHOT")))
- .include(dependency("org.json", "json", "20250107"));
- }
-
- public static void main(String[] args) {
- new CryptoPriceExampleBuild().start(args);
- }
-
- @Override
- public void compile() throws Exception {
- new CompileKotlinOperation()
- .fromProject(this)
- .execute();
-
- // Also compile the Java source code
- super.compile();
- }
-
- @BuildCommand(value = "run-java", summary = "Runs the Java example")
- public void runJava() throws Exception {
- new RunOperation()
- .fromProject(this)
- .mainClass("com.example.CryptoPriceSample")
- .execute();
- }
-}
diff --git a/examples/bld/src/main/kotlin/com/example/CryptoPriceExample.kt b/examples/bld/src/main/kotlin/com/example/CryptoPriceExample.kt
deleted file mode 100644
index 6aa15fc..0000000
--- a/examples/bld/src/main/kotlin/com/example/CryptoPriceExample.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.example
-
-import net.thauvin.erik.crypto.CryptoException
-import net.thauvin.erik.crypto.CryptoPrice.Companion.apiCall
-import net.thauvin.erik.crypto.CryptoPrice.Companion.buyPrice
-import net.thauvin.erik.crypto.CryptoPrice.Companion.sellPrice
-import net.thauvin.erik.crypto.CryptoPrice.Companion.spotPrice
-import org.json.JSONObject
-import java.io.IOException
-import java.util.*
-
-fun main(args: Array) {
- try {
- if (args.isNotEmpty()) {
- val currency = if (args.size == 2) args[1] else Currency.getInstance(Locale.getDefault()).currencyCode
- val price = spotPrice(args[0], currency)
- println("The current ${price.base} price is ${price.toCurrency()}")
- } else {
- // Get current Bitcoin spot price.
- val price = spotPrice("BTC")
- println("The current Bitcoin price is ${price.toCurrency()}")
-
- println()
-
- // Get current Ethereum sell price in Pound sterling.
- val gbpPrice = sellPrice("ETH", "GBP")
- println("The current Ethereum sell price is ${gbpPrice.toCurrency()}")
-
- // Get current Litecoin buy price in Euro.
- val euroPrice = buyPrice("LTC", "EUR")
- println("The current Litecoin buy price is ${euroPrice.toCurrency()}")
-
- println()
-
- // Get exchange rate using API.
- // See: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates
- val response = apiCall(listOf("exchange-rates"), mapOf("currency" to "usd"))
- val rates = JSONObject(response).getJSONObject("data").getJSONObject("rates")
- println("The USD-EUR exchange rate is: ${rates.getString("EUR")}")
- }
- } catch (e: CryptoException) {
- System.err.println("HTTP Status Code: ${e.statusCode}")
- System.err.println("${e.message} (${e.id})")
- } catch (ignore: IllegalArgumentException) {
- System.err.println("Could not display the specified currency: ${args[1]}")
- } catch (e: IOException) {
- System.err.println(e.message)
- }
-}
diff --git a/examples/gradle/build.gradle.kts b/examples/build.gradle.kts
similarity index 61%
rename from examples/gradle/build.gradle.kts
rename to examples/build.gradle.kts
index 626d902..1ff1bee 100644
--- a/examples/gradle/build.gradle.kts
+++ b/examples/build.gradle.kts
@@ -2,10 +2,15 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("application")
- id("com.github.ben-manes.versions") version "0.51.0"
- kotlin("jvm") version "2.1.20"
+ id("com.github.ben-manes.versions") version "0.48.0"
+ kotlin("jvm") version "1.9.10"
}
+// ./gradlew run
+// ./gradlew runJava
+// ./gradlew run --args="btc"
+// ./gradlew runJava --args="eth eur"
+
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
repositories {
@@ -15,8 +20,8 @@ repositories {
}
dependencies {
- implementation("net.thauvin.erik:cryptoprice:1.0.3-SNAPSHOT")
- implementation("org.json:json:20240303")
+ implementation("net.thauvin.erik:cryptoprice:1.0.1")
+ implementation("org.json:json:20230618")
}
java {
@@ -28,11 +33,11 @@ application {
mainClass.set("com.example.CryptoPriceExampleKt")
}
-kotlin {
- compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
-}
-
tasks {
+ withType().configureEach {
+ kotlinOptions.jvmTarget = java.targetCompatibility.toString()
+ }
+
register("runJava") {
group = "application"
mainClass.set("com.example.CryptoPriceSample")
diff --git a/examples/gradle/.idea/.gitignore b/examples/gradle/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/examples/gradle/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/examples/gradle/.idea/.name b/examples/gradle/.idea/.name
deleted file mode 100644
index 925a65b..0000000
--- a/examples/gradle/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-cryptoprice-examples-gradle
\ No newline at end of file
diff --git a/examples/gradle/.idea/compiler.xml b/examples/gradle/.idea/compiler.xml
deleted file mode 100644
index fb7f4a8..0000000
--- a/examples/gradle/.idea/compiler.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/gradle/.idea/gradle.xml b/examples/gradle/.idea/gradle.xml
deleted file mode 100644
index 7d3b3e8..0000000
--- a/examples/gradle/.idea/gradle.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/gradle/.idea/inspectionProfiles/Project_Default.xml b/examples/gradle/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 1e01b48..0000000
--- a/examples/gradle/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/gradle/.idea/jarRepositories.xml b/examples/gradle/.idea/jarRepositories.xml
deleted file mode 100644
index 4e9cedf..0000000
--- a/examples/gradle/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/gradle/.idea/kotlinc.xml b/examples/gradle/.idea/kotlinc.xml
deleted file mode 100644
index ae3f30a..0000000
--- a/examples/gradle/.idea/kotlinc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/gradle/.idea/misc.xml b/examples/gradle/.idea/misc.xml
deleted file mode 100644
index 3ef1a84..0000000
--- a/examples/gradle/.idea/misc.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/gradle/.idea/vcs.xml b/examples/gradle/.idea/vcs.xml
deleted file mode 100644
index b2bdec2..0000000
--- a/examples/gradle/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/gradle/README.md b/examples/gradle/README.md
deleted file mode 100644
index fd8a622..0000000
--- a/examples/gradle/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-## Kotlin Example
-To run the Kotlin example:
-
-```console
-./gradlew run
-./gradlew run --args="btc"
-./gradlew run --args="eth eur"
-```
-
-## Java Example
-
-To run the Java example:
-
-```console
-./gradlew runJava
-./gradlew runJava --args="btc"
-./gradlew runJava --args="eth eur"
-```
diff --git a/examples/gradle/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 1b33c55..0000000
Binary files a/examples/gradle/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/examples/gradle/src/main/java/com/example/CryptoPriceSample.java b/examples/gradle/src/main/java/com/example/CryptoPriceSample.java
deleted file mode 100644
index e9e33e5..0000000
--- a/examples/gradle/src/main/java/com/example/CryptoPriceSample.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.example;
-
-import net.thauvin.erik.crypto.CryptoException;
-import net.thauvin.erik.crypto.CryptoPrice;
-import org.json.JSONObject;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Currency;
-import java.util.List;
-import java.util.Locale;
-
-public class CryptoPriceSample {
- public static void main(final String[] args) {
- try {
- if (args.length > 0) {
- final String currency;
- if (args.length == 2) {
- currency = args[1];
- } else {
- currency = Currency.getInstance(Locale.getDefault()).getCurrencyCode();
- }
- final var price = CryptoPrice.spotPrice(args[0], currency);
- System.out.println("The current " + price.getBase() + " price is " + price.toCurrency());
- } else {
- // Get current Bitcoin spot price.
- final var price = CryptoPrice.spotPrice("BTC");
- System.out.println("The current Bitcoin price is " + price.toCurrency());
-
- System.out.println();
-
- // Get current Ethereum buy price in Pound sterling.
- final var gbpPrice = CryptoPrice.buyPrice("ETH", "GBP");
- System.out.println("The current Ethereum buy price is " + gbpPrice.toCurrency());
-
- // Get current Litecoin sell price in Euros.
- final var euroPrice = CryptoPrice.sellPrice("LTC", "EUR");
- System.out.println("The current Litecoin sell price is " + euroPrice.toCurrency());
-
- System.out.println();
-
- // Get exchange rate using API.
- // See: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates
- final var response = CryptoPrice.apiCall(List.of("exchange-rates"),
- Collections.singletonMap("currency", "USD"));
- final var rates = new JSONObject(response).getJSONObject("data").getJSONObject("rates");
- System.out.println("The USD-EUR exchange rate is: " + rates.getString("EUR"));
- }
- } catch (CryptoException e) {
- System.err.println("HTTP Status Code: " + e.getStatusCode());
- System.err.println(e.getMessage() + " (" + e.getId() + ')');
- } catch (IllegalArgumentException e) {
- System.err.println("Could not display the specified currency: " + args[1]);
- } catch (IOException e) {
- System.err.println(e.getMessage());
- }
- }
-}
diff --git a/examples/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..7f93135
Binary files /dev/null and b/examples/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/examples/gradle/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/wrapper/gradle-wrapper.properties
similarity index 94%
rename from examples/gradle/gradle/wrapper/gradle-wrapper.properties
rename to examples/gradle/wrapper/gradle-wrapper.properties
index ca025c8..ac72c34 100644
--- a/examples/gradle/gradle/wrapper/gradle-wrapper.properties
+++ b/examples/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/examples/gradle/gradlew b/examples/gradlew
similarity index 90%
rename from examples/gradle/gradlew
rename to examples/gradlew
index 23d15a9..0adc8e1 100755
--- a/examples/gradle/gradlew
+++ b/examples/gradlew
@@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-License-Identifier: Apache-2.0
-#
##############################################################################
#
@@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob/HEAD/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/.
@@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +112,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH="\\\"\\\""
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -147,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC2039,SC3045
+ # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -155,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC2039,SC3045
+ # shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -204,16 +202,16 @@ fi
# 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"'
-# Collect all arguments for the java command:
-# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
-# and any embedded shellness will be escaped.
-# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
-# treated as '${Hostname}' itself on the command line.
+# 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" \
- -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+ org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
diff --git a/examples/gradle/gradlew.bat b/examples/gradlew.bat
similarity index 87%
rename from examples/gradle/gradlew.bat
rename to examples/gradlew.bat
index db3a6ac..93e3f59 100644
--- a/examples/gradle/gradlew.bat
+++ b/examples/gradlew.bat
@@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
-@rem SPDX-License-Identifier: Apache-2.0
-@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
-echo. 1>&2
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
-echo. 1>&2
-echo Please set the JAVA_HOME variable in your environment to match the 1>&2
-echo location of your Java installation. 1>&2
+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
@@ -59,22 +57,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
-echo. 1>&2
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
-echo. 1>&2
-echo Please set the JAVA_HOME variable in your environment to match the 1>&2
-echo location of your Java installation. 1>&2
+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=
+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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
+"%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
diff --git a/examples/gradle/settings.gradle.kts b/examples/settings.gradle.kts
similarity index 100%
rename from examples/gradle/settings.gradle.kts
rename to examples/settings.gradle.kts
diff --git a/examples/bld/src/main/java/com/example/CryptoPriceSample.java b/examples/src/main/java/com/example/CryptoPriceSample.java
similarity index 100%
rename from examples/bld/src/main/java/com/example/CryptoPriceSample.java
rename to examples/src/main/java/com/example/CryptoPriceSample.java
diff --git a/examples/gradle/src/main/kotlin/com/example/CryptoPriceExample.kt b/examples/src/main/kotlin/com/example/CryptoPriceExample.kt
similarity index 97%
rename from examples/gradle/src/main/kotlin/com/example/CryptoPriceExample.kt
rename to examples/src/main/kotlin/com/example/CryptoPriceExample.kt
index 6aa15fc..4eb0a6c 100644
--- a/examples/gradle/src/main/kotlin/com/example/CryptoPriceExample.kt
+++ b/examples/src/main/kotlin/com/example/CryptoPriceExample.kt
@@ -41,7 +41,7 @@ fun main(args: Array) {
} catch (e: CryptoException) {
System.err.println("HTTP Status Code: ${e.statusCode}")
System.err.println("${e.message} (${e.id})")
- } catch (ignore: IllegalArgumentException) {
+ } catch (e: IllegalArgumentException) {
System.err.println("Could not display the specified currency: ${args[1]}")
} catch (e: IOException) {
System.err.println(e.message)
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..e69de29
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..7f93135
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..ac72c34
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..0adc8e1
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,249 @@
+#!/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/HEAD/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
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# 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
+ if ! command -v java >/dev/null 2>&1
+ then
+ 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
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
+ 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
+
+
+# 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"'
+
+# 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 \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# 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" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..93e3f59
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,92 @@
+@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=.
+@rem This is normally unused
+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% equ 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% equ 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!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar
deleted file mode 100644
index 19f87d3..0000000
Binary files a/lib/bld/bld-wrapper.jar and /dev/null differ
diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties
deleted file mode 100644
index 751133d..0000000
--- a/lib/bld/bld-wrapper.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-bld.downloadExtensionJavadoc=false
-bld.downloadExtensionSources=true
-bld.downloadLocation=
-bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.10-SNAPSHOT
-bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.4-SNAPSHOT
-bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10
-bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
-bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
-bld.sourceDirectories=
-bld.version=2.2.1
diff --git a/pom.xml b/pom.xml
index f3345e6..3deee5d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,10 +1,14 @@
-
+
+
+
+
+
+
4.0.0
net.thauvin.erik
cryptoprice
- 1.0.3-SNAPSHOT
+ 1.0.1
cryptoprice
Retrieve cryptocurrencies prices
https://github.com/ethauvin/cryptoprice
@@ -14,26 +18,6 @@
https://opensource.org/licenses/BSD-3-Clause
-
-
- org.jetbrains.kotlin
- kotlin-stdlib
- 2.1.20
- compile
-
-
- org.json
- json
- 20250107
- compile
-
-
- com.squareup.okhttp3
- okhttp
- 4.12.0
- compile
-
-
ethauvin
@@ -47,4 +31,39 @@
scm:git:git@github.com:ethauvin/cryptoprice.git
https://github.com/ethauvin/cryptoprice
+
+ GitHub
+ https://github.com/ethauvin/cryptoprice/issues
+
+
+
+
+ org.jetbrains.kotlin
+ kotlin-bom
+ 1.9.10
+ pom
+ import
+
+
+
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib-jdk8
+ 1.9.10
+ runtime
+
+
+ com.squareup.okhttp3
+ okhttp
+ 4.11.0
+ runtime
+
+
+ org.json
+ json
+ 20230618
+ runtime
+
+
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..5258f17
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,18 @@
+plugins {
+ id("com.gradle.enterprise").version("3.6.3")
+}
+
+gradleEnterprise {
+ buildScan {
+ link("GitHub", "https://github.com/ethauvin/cryptoprice/tree/master")
+ if (!System.getenv("CI").isNullOrEmpty()) {
+ isUploadInBackground = false
+ publishOnFailure()
+ tag("CI")
+ }
+ termsOfServiceUrl = "https://gradle.com/terms-of-service"
+ termsOfServiceAgree = "yes"
+ }
+}
+
+rootProject.name = "cryptoprice"
diff --git a/sonar-project.properties b/sonar-project.properties
deleted file mode 100644
index 423b224..0000000
--- a/sonar-project.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-sonar.organization=ethauvin-github
-sonar.projectKey=ethauvin_cryptoprice
-sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
-sonar.sources=src/main/kotlin/
-sonar.tests=src/test/kotlin/
-sonar.java.binaries=build/main,build/test
-sonar.java.libraries=lib/compile/*.jar
diff --git a/src/bld/java/net/thauvin/erik/crypto/CryptoPriceBuild.java b/src/bld/java/net/thauvin/erik/crypto/CryptoPriceBuild.java
deleted file mode 100644
index 18b18ec..0000000
--- a/src/bld/java/net/thauvin/erik/crypto/CryptoPriceBuild.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * CryptoPriceBuild.java
- *
- * Copyright 2021-2025 Erik C. Thauvin (erik@thauvin.net)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of this project nor the names of its contributors may be
- * used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package net.thauvin.erik.crypto;
-
-import rife.bld.BuildCommand;
-import rife.bld.Project;
-import rife.bld.extension.CompileKotlinOperation;
-import rife.bld.extension.DetektOperation;
-import rife.bld.extension.DokkaOperation;
-import rife.bld.extension.JacocoReportOperation;
-import rife.bld.extension.dokka.LoggingLevel;
-import rife.bld.extension.dokka.OutputFormat;
-import rife.bld.extension.kotlin.CompileOptions;
-import rife.bld.operations.exceptions.ExitStatusException;
-import rife.bld.publish.PomBuilder;
-import rife.bld.publish.PublishDeveloper;
-import rife.bld.publish.PublishLicense;
-import rife.bld.publish.PublishScm;
-import rife.tools.exceptions.FileUtilsErrorException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import static rife.bld.dependencies.Repository.*;
-import static rife.bld.dependencies.Scope.compile;
-import static rife.bld.dependencies.Scope.test;
-
-public class CryptoPriceBuild extends Project {
- final File srcMainKotlin = new File(srcMainDirectory(), "kotlin");
-
- public CryptoPriceBuild() {
- pkg = "net.thauvin.erik.crypto";
- name = "cryptoprice";
- version = version(1, 0, 3, "SNAPSHOT");
-
- mainClass = "net.thauvin.erik.crypto.CryptoPrice";
-
- javaRelease = 11;
- downloadSources = true;
- autoDownloadPurge = true;
- repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
-
- final var kotlin = version(2, 1, 20);
- scope(compile)
- .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin))
- .include(dependency("org.json", "json", "20250107"))
- .include(dependency("com.squareup.okhttp3", "okhttp", version(4, 12, 0)));
- scope(test)
- .include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 28, 1)))
- .include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
- .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 2)))
- .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 2)))
- .include(dependency("org.junit.platform", "junit-platform-launcher", version(1, 12, 2)));
-
- publishOperation()
- .repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS_LEGACY.location())
- .withCredentials(property("sonatype.user"), property("sonatype.password"))
- : repository(SONATYPE_RELEASES_LEGACY.location())
- .withCredentials(property("sonatype.user"), property("sonatype.password")))
- .repository(repository("github"))
- .info()
- .groupId("net.thauvin.erik")
- .artifactId(name)
- .description("Retrieve cryptocurrencies prices")
- .url("https://github.com/ethauvin/" + name)
- .developer(new PublishDeveloper()
- .id("ethauvin")
- .name("Erik C. Thauvin")
- .email("erik@thauvin.net")
- .url("https://erik.thauvin.net/")
- )
- .license(new PublishLicense()
- .name("BSD 3-Clause")
- .url("https://opensource.org/licenses/BSD-3-Clause")
- )
- .scm(new PublishScm()
- .connection("scm:git:https://github.com/ethauvin/" + name + ".git")
- .developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git")
- .url("https://github.com/ethauvin/" + name)
- )
- .signKey(property("sign.key"))
- .signPassphrase(property("sign.passphrase"));
-
- jarSourcesOperation().sourceDirectories(srcMainKotlin);
- }
-
- public static void main(final String[] args) {
- // Enable detailed logging for the extensions
- final var level = Level.ALL;
- final var logger = Logger.getLogger("rife.bld.extension");
- final var consoleHandler = new ConsoleHandler();
-
- consoleHandler.setLevel(level);
- logger.addHandler(consoleHandler);
- logger.setLevel(level);
- logger.setUseParentHandlers(false);
-
- new CryptoPriceBuild().start(args);
- }
-
- @BuildCommand(summary = "Compiles the Kotlin project")
- @Override
- public void compile() throws Exception {
- new CompileKotlinOperation()
- .fromProject(this)
- .compileOptions(new CompileOptions().verbose(true))
- .execute();
- }
-
- @BuildCommand(summary = "Checks source with Detekt")
- public void detekt() throws ExitStatusException, IOException, InterruptedException {
- new DetektOperation()
- .fromProject(this)
- .execute();
- }
-
- @BuildCommand(value = "detekt-baseline", summary = "Creates the Detekt baseline")
- public void detektBaseline() throws ExitStatusException, IOException, InterruptedException {
- new DetektOperation()
- .fromProject(this)
- .baseline("detekt-baseline.xml")
- .createBaseline(true)
- .execute();
- }
-
- @BuildCommand(summary = "Generates JaCoCo Reports")
- public void jacoco() throws Exception {
- new JacocoReportOperation()
- .fromProject(this)
- .sourceFiles(srcMainKotlin)
- .execute();
- }
-
- @Override
- public void javadoc() throws ExitStatusException, IOException, InterruptedException {
- new DokkaOperation()
- .fromProject(this)
- .loggingLevel(LoggingLevel.INFO)
- .moduleName("CryptoPrice")
- .moduleVersion(version.toString())
- .outputDir(new File(buildDirectory(), "javadoc"))
- .outputFormat(OutputFormat.JAVADOC)
- .execute();
- }
-
- @Override
- public void publish() throws Exception {
- super.publish();
- pomRoot();
- }
-
- @Override
- public void publishLocal() throws Exception {
- super.publishLocal();
- pomRoot();
- }
-
- @BuildCommand(value = "pom-root", summary = "Generates the POM file in the root directory")
- public void pomRoot() throws FileUtilsErrorException {
- PomBuilder.generateInto(publishOperation().fromProject(this).info(), dependencies(),
- new File(workDirectory, "pom.xml"));
- }
-}
diff --git a/src/main/kotlin/net/thauvin/erik/crypto/CryptoException.kt b/src/main/kotlin/net/thauvin/erik/crypto/CryptoException.kt
index a4e599b..38fd2df 100644
--- a/src/main/kotlin/net/thauvin/erik/crypto/CryptoException.kt
+++ b/src/main/kotlin/net/thauvin/erik/crypto/CryptoException.kt
@@ -1,7 +1,7 @@
/*
* CryptoException.kt
*
- * Copyright 2021-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2021-2023 Erik C. Thauvin (erik@thauvin.net)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/src/main/kotlin/net/thauvin/erik/crypto/CryptoPrice.kt b/src/main/kotlin/net/thauvin/erik/crypto/CryptoPrice.kt
index 578efe5..6cfdfcd 100644
--- a/src/main/kotlin/net/thauvin/erik/crypto/CryptoPrice.kt
+++ b/src/main/kotlin/net/thauvin/erik/crypto/CryptoPrice.kt
@@ -1,7 +1,7 @@
/*
* CryptoPrice.kt
*
- * Copyright 2021-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2021-2023 Erik C. Thauvin (erik@thauvin.net)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -42,8 +42,6 @@ import java.math.BigDecimal
import java.text.NumberFormat
import java.time.LocalDate
import java.util.*
-import java.util.logging.Level
-import java.util.logging.Logger
/**
* Retrieves and holds a cryptocurrency price.
@@ -59,9 +57,6 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
// Coinbase API URL
private const val COINBASE_API_URL = "https://api.coinbase.com/v2/"
- /** The logger instance. **/
- val logger: Logger by lazy { Logger.getLogger(CryptoPrice::class.java.simpleName) }
-
/**
* Converts JSON data object to [CryptoPrice].
*
@@ -110,9 +105,6 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
id = "empty_response",
message = "Empty response."
)
- if (logger.isLoggable(Level.FINE)) {
- logger.fine(body)
- }
try {
val json = JSONObject(body)
if (response.isSuccessful) {
@@ -121,16 +113,12 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
if (json.has("errors")) {
val data = json.getJSONArray("errors")
throw CryptoException(
- response.code,
- data.getJSONObject(0).getString("id"),
+ response.code, data.getJSONObject(0).getString("id"),
data.getJSONObject(0).getString("message")
)
} else {
- throw CryptoException(
- response.code,
- json.getString("error"),
- json.getString("message")
- )
+ throw CryptoException(response.code, json.getString("error"),
+ json.getString("message"))
}
}
} catch (e: JSONException) {
@@ -157,13 +145,9 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
*/
@JvmStatic
fun main(args: Array) {
- if (args.isEmpty()) {
- println("Please specify one or more ticker symbols as arguments.")
- } else {
- args.forEach {
- with(spotPrice(it)) {
- println("$base:\t" + "%10s".format(toCurrency()))
- }
+ args.forEach {
+ with(spotPrice(it)) {
+ println("$base:\t" + "%10s".format(toCurrency()))
}
}
}
diff --git a/src/test/kotlin/net/thauvin/erik/crypto/CryptoPriceTest.kt b/src/test/kotlin/net/thauvin/erik/crypto/CryptoPriceTest.kt
index fcc64f2..1ac50e5 100644
--- a/src/test/kotlin/net/thauvin/erik/crypto/CryptoPriceTest.kt
+++ b/src/test/kotlin/net/thauvin/erik/crypto/CryptoPriceTest.kt
@@ -1,7 +1,7 @@
/*
* CryptoPriceTest.kt
*
- * Copyright 2021-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2021-2023 Erik C. Thauvin (erik@thauvin.net)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -42,12 +42,9 @@ import net.thauvin.erik.crypto.CryptoPrice.Companion.sellPrice
import net.thauvin.erik.crypto.CryptoPrice.Companion.spotPrice
import net.thauvin.erik.crypto.CryptoPrice.Companion.toPrice
import org.json.JSONObject
-import org.junit.jupiter.api.BeforeAll
import java.math.BigDecimal
import java.time.LocalDate
import java.util.*
-import java.util.logging.ConsoleHandler
-import java.util.logging.Level
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
@@ -83,6 +80,7 @@ class CryptoPriceTest {
prop(CryptoPrice::currency).isEqualTo("EUR")
prop(CryptoPrice::amount).isGreaterThan(BigDecimal(0))
}
+
}
}
@@ -242,16 +240,4 @@ class CryptoPriceTest {
assertEquals(json, price.toString(), "toString()")
assertEquals(price.toString(), price.toJson(""), "toString() = toJson('')")
}
-
- companion object {
- @JvmStatic
- @BeforeAll
- fun beforeAll() {
- with(CryptoPrice.logger) {
- addHandler(ConsoleHandler().apply { level = Level.FINE })
- level = Level.FINE
- useParentHandlers = false
- }
- }
- }
}