Updated dependencies
Bumped bld to version 2.1.0 Bumped Gradle to version 8.10.111
This commit is contained in:
parent
bc8f5d7670
commit
925338034b
29 changed files with 139 additions and 134 deletions
2
examples/gradle/.gitignore
vendored
2
examples/gradle/.gitignore
vendored
|
@ -3,3 +3,5 @@
|
|||
|
||||
# Ignore Gradle build output directory
|
||||
build
|
||||
|
||||
bin
|
||||
|
|
|
@ -1,47 +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
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
try {
|
||||
if (args.isNotEmpty()) {
|
||||
val price = if (args.size == 2) spotPrice(args[0], args[1]) else spotPrice(args[0])
|
||||
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)
|
||||
} catch (ignore: IllegalArgumentException) {
|
||||
System.err.println("Could not display the specified currency: ${args[1]}")
|
||||
} catch (e: IOException) {
|
||||
System.err.println(e.message)
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|||
plugins {
|
||||
id("application")
|
||||
id("com.github.ben-manes.versions") version "0.51.0"
|
||||
kotlin("jvm") version "2.0.0"
|
||||
kotlin("jvm") version "2.0.20"
|
||||
}
|
||||
|
||||
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
|
||||
|
|
BIN
examples/gradle/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
examples/gradle/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
7
examples/gradle/gradlew
vendored
7
examples/gradle/gradlew
vendored
|
@ -15,6 +15,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
|
@ -55,7 +57,7 @@
|
|||
# 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
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
@ -84,7 +86,8 @@ 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
|
2
examples/gradle/gradlew.bat
vendored
2
examples/gradle/gradlew.bat
vendored
|
@ -13,6 +13,8 @@
|
|||
@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 ##########################################################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue