Skip to content

Commit

Permalink
service class created to fetch data
Browse files Browse the repository at this point in the history
  • Loading branch information
kulloveth committed Feb 28, 2020
1 parent 30af9e8 commit 9802f4d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {
}

dependencies {
def lifecycle_version = "2.1.0"
def lifecycle_version = "2.2.0"

//glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package kulloveth.developer.com.countrydetails.api

import io.reactivex.Single
import kulloveth.developer.com.countrydetails.data.model.CountryDetails
import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET

interface RetrofitService {

@GET("rest/v2/all/")
fun fetchCharacterName(): Single<Response<CountryDetails>>


companion object {
fun getRetrofitInstance(): RetrofitService {
val retrofit: Retrofit = Retrofit.Builder()
.baseUrl("https://restcountries.eu/")
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
return retrofit.create(RetrofitService::class.java)
}
}
}

0 comments on commit 9802f4d

Please sign in to comment.