From 11c449278fbf51b577a7184fda6e51726e1da340 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 23 May 2021 14:19:12 -0700 Subject: [PATCH] Improved Javadocs. --- README.md | 6 +++--- detekt-baseline.xml | 2 +- .../kotlin/net/thauvin/erik/crypto/CryptoPrice.kt | 11 ++++++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b9379ca..81d8dde 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ marketPrice( ``` Parameters | Description -:---------- |:------------------------------------------------------- -`base` | The cryptocurrency ticker symbol (BTC, ETH, ETH2, etc.) -`currency` | The fiat currency ISO 4217 code. +:---------- |:------------------------------------------------------------- +`base` | The cryptocurrency ticker symbol (`BTC`, `ETH`, `ETH2`, etc.) +`currency` | The fiat currency ISO 4217 code. (`USD`, `GBP`, `EUR`, etc.) `date` | The `LocalDate` for historical price data. A `CryptoPrice` is returned defined as follows: diff --git a/detekt-baseline.xml b/detekt-baseline.xml index c4d9ac8..7a95db9 100644 --- a/detekt-baseline.xml +++ b/detekt-baseline.xml @@ -3,6 +3,6 @@ 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 + ThrowsCount:CryptoPrice.kt$CryptoPrice.Companion$ @JvmStatic @Throws(CryptoException::class) fun String.toPrice(): CryptoPrice diff --git a/src/main/kotlin/net/thauvin/erik/crypto/CryptoPrice.kt b/src/main/kotlin/net/thauvin/erik/crypto/CryptoPrice.kt index 2dd08eb..884196b 100644 --- a/src/main/kotlin/net/thauvin/erik/crypto/CryptoPrice.kt +++ b/src/main/kotlin/net/thauvin/erik/crypto/CryptoPrice.kt @@ -41,13 +41,18 @@ import java.io.IOException import java.time.LocalDate /** - * The `CryptoPrice` class + * A small Kotlin/Java library for retrieving cryptocurrencies current market prices. + * + * @author [Erik C. Thauvin](https://erik.thauvin.net/) */ open class CryptoPrice(val base: String, val currency: String, val amount: Double) { companion object { // Coinbase API URL private const val COINBASE_API_URL = "https://api.coinbase.com/v2/" + /** + * Convert JSON data object to [CryptoPrice]. + */ @JvmStatic @Throws(CryptoException::class) fun String.toPrice(): CryptoPrice { @@ -115,6 +120,10 @@ open class CryptoPrice(val base: String, val currency: String, val amount: Doubl /** * Retrieve the current market price. + * + * @param base The cryptocurrency ticker symbol. (`BTC`, `ETH`, `ETH2`, etc.) + * @param currency The fiat currency ISO 4217 code. (`USD`, `GPB`, `EUR`, etc.) + * @param date The [LocalDate] for historical price data. */ @JvmStatic @JvmOverloads