package com.drabarz.karola.raillearn.service;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class ServiceFactory {

    public static <T> T createRetrofitService(final Class<T> clazz, final String endPoint) {
        final Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(endPoint)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .build();
        T service = retrofit.create(clazz);

        return service;
    }
}

@@ -312,21 +312,88 @@
         
-final
+return createRetrofit(endPoint).create(clazz);%0A    %7D%0A%0A    private static
  Retrofi
@@ -398,18 +398,56 @@
 fit 
+c
 re
+ateRe
 trofit
- =
+(String endPoint) %7B%0A        return
  new
@@ -673,77 +673,8 @@
 ();%0A
-        T service = retrofit.create(clazz);%0A%0A        return service;%0A
     

Refactor retrofit service.