Skip to content

Commit 87d4a45

Browse files
committed
Refactor conversion into expected string value
1 parent 1c9d8cb commit 87d4a45

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedStoreProfile.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ data class FetchedStoreProfile(
334334
app;
335335

336336
override fun toString(): String {
337+
return asApiString()
338+
}
339+
340+
fun asApiString(): String {
337341
return super.toString().replace("_", "-")
338342
}
339343
}

src/main/kotlin/com/ecwid/apiclient/v3/jsontransformer/gson/typeadapters/RatesCalculationTypeDeserializer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ class RatesCalculationTypeDeserializer : JsonDeserializer<RatesCalculationType>
1313
context: JsonDeserializationContext
1414
): RatesCalculationType? {
1515
val strValue = json.asString
16-
return RatesCalculationType.entries.firstOrNull { it.toString() == strValue }
16+
return RatesCalculationType.entries.firstOrNull { it.asApiString() == strValue }
1717
}
1818
}

0 commit comments

Comments
 (0)