use of retrofit.RestAdapter 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));
}
use of retrofit.RestAdapter in project Hummingbird-for-Android by xiprox.
the class HummingbirdApi method setupServices.
private void setupServices() {
RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(API_HOST_v1).setLogLevel(RestAdapter.LogLevel.FULL).build();
service = restAdapter.create(HummingbirdService.class);
}
use of retrofit.RestAdapter in project cw-omnibus by commonsguy.
the class SOTests method fetchQuestions.
@Test(timeout = 30000)
public void fetchQuestions() throws InterruptedException {
RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("https://api.stackexchange.com").build();
StackOverflowInterface so = restAdapter.create(StackOverflowInterface.class);
so.questions("android", new Callback<SOQuestions>() {
@Override
public void success(SOQuestions soQuestions, Response response) {
questions = soQuestions;
responseLatch.countDown();
}
@Override
public void failure(RetrofitError error) {
responseLatch.countDown();
}
});
responseLatch.await();
Assert.assertNotNull(questions);
Assert.assertEquals(30, questions.items.size());
for (Item item : questions.items) {
Assert.assertNotNull(item.title);
Assert.assertNotNull(item.link);
}
}
use of retrofit.RestAdapter in project divide by HiddenStage.
the class AbstractWebManager method createRestAdapter.
private RestAdapter createRestAdapter(Config config) {
RestAdapter.Builder builder = new RestAdapter.Builder();
builder.setClient(new OkClient(config.client)).setEndpoint(config.serverUrl).setLogLevel(RestAdapter.LogLevel.FULL).setLog(new RestAdapter.Log() {
@Override
public void log(String s) {
retrologger.debug(s);
}
}).setConverter(new GsonConverter(new Gson())).setRequestInterceptor(new RequestInterceptor() {
@Override
public void intercept(RequestFacade requestFacade) {
onRequest(requestFacade);
}
}).setProfiler(new Profiler() {
@Override
public Object beforeCall() {
return null;
}
@Override
public void afterCall(RequestInformation requestInformation, long l, int i, Object o) {
retrologger.error("afterCall(" + requestInformation.getRelativePath() + ":" + requestInformation.getMethod() + ": " + i + " : " + o);
requestEventPublisher.onNext(new RequestObject(requestInformation, l, i, o));
}
});
return builder.build();
}
use of retrofit.RestAdapter in project divide by HiddenStage.
the class AuthServerHelper method buildTestService.
private TestService buildTestService(String url) {
if (testService == null) {
RestAdapter restAdapter = new RestAdapter.Builder().setClient(new OkClient()).setEndpoint(url).setLogLevel(RestAdapter.LogLevel.FULL).setLog(new RestAdapter.Log() {
@Override
public void log(String s) {
System.out.println(s);
}
}).build();
testService = restAdapter.create(TestService.class);
}
return testService;
}
Aggregations