Remove ssl and scrapperHost params from Sdk

This commit is contained in:
Mikołaj Pich 2019-11-25 18:31:06 +01:00
parent 2cfe46a788
commit 3a094749c4
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA
4 changed files with 8 additions and 28 deletions

View file

@ -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
)
}
}

View file

@ -19,17 +19,15 @@ fun List<ApiStudent>.mapStudents(symbol: String): List<Student> {
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<ScrapperStudent>.mapStudents(ssl: Boolean, scrapperHost: String): List<Student> {
fun List<ScrapperStudent>.mapStudents(): List<Student> {
return map {
Student(
email = it.email,
@ -43,10 +41,8 @@ fun List<ScrapperStudent>.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 = ""
)

View file

@ -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
)

View file

@ -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"
}