Search in sources :

Example 1 with EvenementCommunauteList

use of ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunauteList in project ETSMobile-Android2 by ApplETS.

the class AppletsApiEvenementsRequest method loadDataFromNetwork.

@Override
public EvenementCommunauteList loadDataFromNetwork() throws Exception {
    String eventsAddress = context.getString(R.string.applets_api_events, source.getKey());
    OkHttpClient client = new OkHttpClient();
    Request request = new Request.Builder().url(eventsAddress).get().build();
    Response response = client.newCall(request).execute();
    String result = response.body().string();
    EvenementCommunauteList evenementList = new Gson().fromJson(result, EvenementCommunauteList.class);
    for (EvenementCommunaute event : evenementList) {
        event.setSourceEvenement(source);
    }
    return evenementList;
}
Also used : Response(com.squareup.okhttp.Response) EvenementCommunauteList(ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunauteList) EvenementCommunaute(ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunaute) OkHttpClient(com.squareup.okhttp.OkHttpClient) SpringAndroidSpiceRequest(com.octo.android.robospice.request.springandroid.SpringAndroidSpiceRequest) Request(com.squareup.okhttp.Request) Gson(com.google.gson.Gson)

Aggregations

EvenementCommunaute (ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunaute)1 EvenementCommunauteList (ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunauteList)1 Gson (com.google.gson.Gson)1 SpringAndroidSpiceRequest (com.octo.android.robospice.request.springandroid.SpringAndroidSpiceRequest)1 OkHttpClient (com.squareup.okhttp.OkHttpClient)1 Request (com.squareup.okhttp.Request)1 Response (com.squareup.okhttp.Response)1