Skip to content

Instantly share code, notes, and snippets.

@cdmunoz
Created March 6, 2018 18:46
Show Gist options
  • Save cdmunoz/e9a2bba419e2e27bd9748851e2c6f7db to your computer and use it in GitHub Desktop.
Save cdmunoz/e9a2bba419e2e27bd9748851e2c6f7db to your computer and use it in GitHub Desktop.
class ApiClient {
companion object {
private const val BASE_URL = "https://api.coinmarketcap.com/v1/"
fun getClient(): Retrofit {
val okHttpClient = OkHttpClient.Builder().build()
val moshi = Moshi.Builder().build()
return Builder().client(okHttpClient).baseUrl(BASE_URL)
.addConverterFactory(MoshiConverterFactory.create(moshi))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment