Search in sources :

Example 1 with RMPClient

use of com.tevinjeffrey.rmp.client.RMPClient in project Rutgers-Course-Tracker by tevjef.

the class ClientModule method providesRMPClient.

@Provides
@Singleton
public RMPClient providesRMPClient(OkHttpClient client, Gson gson) {
    OkHttpClient okClient = client.clone();
    okClient.setConnectTimeout(CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
    okClient.setReadTimeout(READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
    RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("http://rutgersapp.tevindev.me:8080/").setLogLevel(RestAdapter.LogLevel.FULL).setConverter(new GsonConverter(gson)).setClient(new OkClient(okClient)).build();
    return new RMPClient(restAdapter.create(ClientService.class));
}
Also used : GsonConverter(retrofit.converter.GsonConverter) RMPClient(com.tevinjeffrey.rmp.client.RMPClient) OkHttpClient(com.squareup.okhttp.OkHttpClient) ClientService(com.tevinjeffrey.rmp.client.ClientService) OkClient(retrofit.client.OkClient) RestAdapter(retrofit.RestAdapter) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Aggregations

OkHttpClient (com.squareup.okhttp.OkHttpClient)1 ClientService (com.tevinjeffrey.rmp.client.ClientService)1 RMPClient (com.tevinjeffrey.rmp.client.RMPClient)1 Provides (dagger.Provides)1 Singleton (javax.inject.Singleton)1 RestAdapter (retrofit.RestAdapter)1 OkClient (retrofit.client.OkClient)1 GsonConverter (retrofit.converter.GsonConverter)1