James
04/21/2018, 4:31 PMclass CurrentPriceApi @Inject constructor(private val cryptoCompareService: CryptoCompareService) {
fun getCurrentPrices(currency: CurrencyType, others: List<CurrencyType>): Single<CryptoCompareCurrentPrices> {
return cryptoCompareService.getCurrentPrices()
}
}
class CryptoCompareCurrentPrices(val json: Map<CurrencyType, Double>)
class CCAdapter {
@FromJson
fun fromJson(json: Map<String, Double>): CryptoCompareCurrentPrices {
return CryptoCompareCurrentPrices(json.mapKeys { CurrencyType.valueOf(it.key) })
}
}