Created
October 20, 2015 20:21
-
-
Save kvofreelance/9568886c0b48cd6ab15c to your computer and use it in GitHub Desktop.
NetworkService
This file contains 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
package com.passengerapp.main.network; | |
import com.passengerapp.BuildConfig; | |
import retrofit.GsonConverterFactory; | |
import retrofit.Retrofit; | |
import retrofit.RxJavaCallAdapterFactory; | |
/** | |
* Created by adventis on 10/15/15. | |
*/ | |
public class NetworkService { | |
private final String END_POINT = BuildConfig.URL; | |
public NetworkApi getApi() { | |
return api; | |
} | |
private NetworkApi api; | |
public NetworkService() { | |
Retrofit service = new Retrofit.Builder() | |
.baseUrl(END_POINT) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.addCallAdapterFactory(RxJavaCallAdapterFactory.create()) | |
.build(); | |
api = service.create(NetworkApi.class); | |
} | |
public NetworkService(String endPoint) { | |
Retrofit service = new Retrofit.Builder() | |
.baseUrl(endPoint) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.addCallAdapterFactory(RxJavaCallAdapterFactory.create()) | |
.build(); | |
api = service.create(NetworkApi.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment