Created
June 1, 2017 18:18
-
-
Save akbarsha03/798b4ddf6e80761351e329f1857c30a7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
object Api { | |
val instance: RestAPI = Retrofit.Builder().run { | |
baseUrl(AppConst.API.BASE_URL) | |
addCallAdapterFactory(RxJavaCallAdapterFactory.create()) | |
addConverterFactory(JacksonConverterFactory.create(ObjectMapper())) | |
client(OkHttpClient.Builder() | |
.apply { | |
addInterceptor(HttpLoggingInterceptor() | |
.apply { level = HttpLoggingInterceptor.Level.BODY }) | |
.takeIf { BuildConfig.DEBUG } | |
} | |
.build()) | |
build() | |
}.create(RestAPI::class.java) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment