-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ECWID-155668 Add "updateShippingOption" method to ecwid-java-api-clie…
…nt - (refactor) fix detekt: get rid of magic numbers
- Loading branch information
1 parent
b754075
commit 1109053
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
7 changes: 5 additions & 2 deletions
7
src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/enums/AvailabilityPeriodTimeUnit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package com.ecwid.apiclient.v3.dto.profile.enums | ||
|
||
private const val MINUTES_IN_DAY = 1_440 // 24 hours * 60 minutes | ||
private const val MINUTES_IN_MONTH = 43_200 // 30 * MINUTES_IN_DAY | ||
|
||
@Suppress("unused") | ||
enum class AvailabilityPeriodTimeUnit(val valueInMinutes: Int) { | ||
DAYS(24 * 60), | ||
MONTHS(30 * 24 * 60); | ||
DAYS(MINUTES_IN_DAY), | ||
MONTHS(MINUTES_IN_MONTH) | ||
} |
10 changes: 7 additions & 3 deletions
10
src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/enums/AvailabilityPeriodType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package com.ecwid.apiclient.v3.dto.profile.enums | ||
|
||
private const val DAYS_IN_WEEK = 7 | ||
private const val SINGLE_UNIT = 1 | ||
private const val MONTHS_IN_CENTURY = 1200 | ||
|
||
@Suppress("unused") | ||
enum class AvailabilityPeriodType(val unitCount: Int, val unit: AvailabilityPeriodTimeUnit?) { | ||
SEVEN_DAYS(7, AvailabilityPeriodTimeUnit.DAYS), | ||
ONE_MONTH(1, AvailabilityPeriodTimeUnit.MONTHS), | ||
UNLIMITED(1200, AvailabilityPeriodTimeUnit.MONTHS); | ||
SEVEN_DAYS(DAYS_IN_WEEK, AvailabilityPeriodTimeUnit.DAYS), | ||
ONE_MONTH(SINGLE_UNIT, AvailabilityPeriodTimeUnit.MONTHS), | ||
UNLIMITED(MONTHS_IN_CENTURY, AvailabilityPeriodTimeUnit.MONTHS) | ||
} |