Cleanup
This commit is contained in:
parent
740e3a9d01
commit
b4e37a5877
4 changed files with 9 additions and 4 deletions
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
|
@ -21,5 +21,10 @@
|
||||||
<option name="name" value="maven" />
|
<option name="name" value="maven" />
|
||||||
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
|
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenLocal" />
|
||||||
|
<option name="name" value="MavenLocal" />
|
||||||
|
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -9,7 +9,7 @@ A simple Kotlin/Java/Android implementation of the spot price [Coinbase Public A
|
||||||
## Examples (TL;DR)
|
## Examples (TL;DR)
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
import net.thauvin.erik.crypto.CryptoPrice
|
import net.thauvin.erik.crypto.CryptoPrice.Companion.marketPrice
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
package net.thauvin.erik.crypto
|
package net.thauvin.erik.crypto
|
||||||
|
|
||||||
@Suppress("EmptySecondaryConstructor", "unused")
|
@Suppress("unused")
|
||||||
class CryptoException : Exception {
|
class CryptoException : Exception {
|
||||||
var statusCode = NO_STATUS
|
var statusCode = NO_STATUS
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ open class CryptoPrice(val base: String, val currency: String, val amount: Doubl
|
||||||
if (json.has("data")) {
|
if (json.has("data")) {
|
||||||
with(json.getJSONObject("data")) {
|
with(json.getJSONObject("data")) {
|
||||||
return CryptoPrice(
|
return CryptoPrice(
|
||||||
getString("base"), getString("currency"), getString("amount").toDouble()
|
getString("base"), getString("currency"), getString("amount").toDouble()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -108,7 +108,7 @@ open class CryptoPrice(val base: String, val currency: String, val amount: Doubl
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
listOf("BTC", "BCH", "BSV", "ETH","ETH2","ETC").forEach {
|
listOf("BTC", "BCH", "BSV", "ETH", "ETH2", "ETC").forEach {
|
||||||
with(marketPrice(it)) {
|
with(marketPrice(it)) {
|
||||||
println("$base: $amount")
|
println("$base: $amount")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue