use of com.meniga.sdk.helpers.ChallengeItemFactory in project mobile-sdk-android by meniga.
the class MockClient method getApi.
public static MenigaAPI getApi(Interceptor myInterceptor) {
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(myInterceptor).build();
final Retrofit retrofit = new Retrofit.Builder().addConverterFactory(new MenigaTransactionsConverter()).addConverterFactory(new MenigaFeedConverter(new MockFeedItemFactory())).addConverterFactory(new MenigaCategoryConverter()).addConverterFactory(new MenigaOfferConverter()).addConverterFactory(new MenigaRedemptionConverter()).addConverterFactory(new MenigaReimbursementAccountConverter()).addConverterFactory(new MenigaIdNameKeyValConverter()).addConverterFactory(new MenigaChallengesConverter(new ChallengeItemFactory())).addConverterFactory(new MenigaFeedItemConverter(new MockFeedItemFactory())).addConverterFactory(new MenigaBaseConverter()).addConverterFactory(GsonConverterFactory.create()).baseUrl("http://meniga.is/api/").client(client).build();
return retrofit.create(MenigaAPI.class);
}
use of com.meniga.sdk.helpers.ChallengeItemFactory in project mobile-sdk-android by meniga.
the class MenigaChallengesTest method gson.
private List<MenigaChallenge> gson(String file) {
ChallengeItemFactory factory = new ChallengeItemFactory();
List<MenigaChallenge> items = new ArrayList<>();
try {
JsonArray arr = MenigaConverter.getAsArray(FileImporter.getInputStreamFromRaw(file));
for (int i = 0; i < arr.size(); i++) {
JsonObject item = arr.get(i).getAsJsonObject();
items.add(factory.getMenigaChallengeItem(item));
}
} catch (IOException e) {
e.printStackTrace();
}
return items;
}
Aggregations