Skip to content

Instantly share code, notes, and snippets.

@AlexGladkov
Created December 5, 2018 08:13
Show Gist options
  • Save AlexGladkov/0330671a0d1b8c436f3365f6da0d3561 to your computer and use it in GitHub Desktop.
Save AlexGladkov/0330671a0d1b8c436f3365f6da0d3561 to your computer and use it in GitHub Desktop.
import io.reactivex.Observable
import io.reactivex.Single
import ru.sddhelp.base.BaseConverter
import ru.sddhelp.data.providers.models.ApiLogin
import ru.sddhelp.data.providers.models.ApiPhone
import ru.sddhelp.data.providers.models.ApiResponse
import ru.sddhelp.data.providers.services.RemoteLoginService
import javax.inject.Inject
/**
* Created by agladkov on 02.03.18.
*/
class LoginProviderImpl(private val remoteLoginService: RemoteLoginService): LoginProvider {
override fun sendPhone(phone: String, campaign: String): Observable<ApiResponse<ApiPhone?>> {
return remoteLoginService.sendPhone(phone = phone, campaign = campaign)
.map { BaseConverter.convertGsonResponse<ApiPhone>(it) }
}
override fun getToken(login: String, password: String, type: String): Observable<ApiResponse<ApiLogin?>> {
return remoteLoginService.getToken(login = login, password = password, type = type)
.map { BaseConverter.convertGsonResponse<ApiLogin>(it) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment