diff --git a/sdk/src/main/kotlin/io/github/wulkanowy/sdk/Sdk.kt b/sdk/src/main/kotlin/io/github/wulkanowy/sdk/Sdk.kt index fd0236d4..779361e9 100644 --- a/sdk/src/main/kotlin/io/github/wulkanowy/sdk/Sdk.kt +++ b/sdk/src/main/kotlin/io/github/wulkanowy/sdk/Sdk.kt @@ -64,25 +64,12 @@ class Sdk { scrapper.baseUrl = value } - var ssl = true - get() = scrapper.ssl - set(value) { - field = value - scrapper.ssl = value - } - - var scrapperHost = "fakelog.cf" - get() = scrapper.host - set(value) { - field = value - scrapper.host = value - } - var email = "" set(value) { field = value scrapper.email = value } + var password = "" set(value) { field = value @@ -173,7 +160,7 @@ class Sdk { this.email = email this.password = password this.symbol = symbol - getStudents().compose(ScrapperExceptionTransformer()).map { it.mapStudents(ssl, host) } + getStudents().compose(ScrapperExceptionTransformer()).map { it.mapStudents() } } } @@ -197,7 +184,7 @@ class Sdk { apiStudents.map { student -> student.copy( loginMode = Mode.HYBRID, - scrapperHost = scrapperStudent.scrapperHost + scrapperBaseUrl = scrapperStudent.scrapperBaseUrl ) } } diff --git a/sdk/src/main/kotlin/io/github/wulkanowy/sdk/mapper/StudentsMapper.kt b/sdk/src/main/kotlin/io/github/wulkanowy/sdk/mapper/StudentsMapper.kt index 67a94310..b8b1b2e7 100644 --- a/sdk/src/main/kotlin/io/github/wulkanowy/sdk/mapper/StudentsMapper.kt +++ b/sdk/src/main/kotlin/io/github/wulkanowy/sdk/mapper/StudentsMapper.kt @@ -19,17 +19,15 @@ fun List.mapStudents(symbol: String): List { schoolName = it.reportingUnitName, loginType = Sdk.ScrapperLoginType.STANDARD, loginMode = Sdk.Mode.API, - mobileBaseUrl = it.mobileBaseUrl, scrapperBaseUrl = "", - ssl = false, - scrapperHost = "", + mobileBaseUrl = it.mobileBaseUrl, privateKey = it.privateKey, certificateKey = it.certificateKey ) } } -fun List.mapStudents(ssl: Boolean, scrapperHost: String): List { +fun List.mapStudents(): List { return map { Student( email = it.email, @@ -43,10 +41,8 @@ fun List.mapStudents(ssl: Boolean, scrapperHost: String): List< schoolSymbol = it.schoolSymbol, studentName = it.studentName, loginMode = Sdk.Mode.SCRAPPER, - mobileBaseUrl = "", scrapperBaseUrl = it.baseUrl, - ssl = ssl, - scrapperHost = scrapperHost, + mobileBaseUrl = "", certificateKey = "", privateKey = "" ) diff --git a/sdk/src/main/kotlin/io/github/wulkanowy/sdk/pojo/Student.kt b/sdk/src/main/kotlin/io/github/wulkanowy/sdk/pojo/Student.kt index e5eb06d1..016feaa7 100644 --- a/sdk/src/main/kotlin/io/github/wulkanowy/sdk/pojo/Student.kt +++ b/sdk/src/main/kotlin/io/github/wulkanowy/sdk/pojo/Student.kt @@ -14,10 +14,8 @@ data class Student( val classId: Int, val loginType: Sdk.ScrapperLoginType, val loginMode: Sdk.Mode, - val mobileBaseUrl: String, val scrapperBaseUrl: String, - val scrapperHost: String, - val ssl: Boolean, + val mobileBaseUrl: String, val certificateKey: String, val privateKey: String ) diff --git a/sdk/src/test/kotlin/io/github/wulkanowy/sdk/SdkRemoteTest.kt b/sdk/src/test/kotlin/io/github/wulkanowy/sdk/SdkRemoteTest.kt index d5d9a709..18fc3c14 100644 --- a/sdk/src/test/kotlin/io/github/wulkanowy/sdk/SdkRemoteTest.kt +++ b/sdk/src/test/kotlin/io/github/wulkanowy/sdk/SdkRemoteTest.kt @@ -94,8 +94,7 @@ class SdkRemoteTest { studentId = 1 loginType = Sdk.ScrapperLoginType.STANDARD - ssl = false - scrapperHost = "fakelog.cf" + scrapperBaseUrl = "http://fakelog.cf" email = "jan@fakelog.cf" password = "jan123" }