@Test public void codes200() { mInterceptor.setFile("codes.json"); assertCompleted(mPrayerClient.getSupportedCodes()); }
@Override public Observable<List<PrayerCode>> getSupportedCodes() { return mApi.getSupportedCodes() .onErrorResumeNext(new Func1<Throwable, Observable<? extends List<PrayerProvider>>>() { @Override public Observable<? extends List<PrayerProvider>> call(Throwable e) { return Observable.error(ErrorWrapper.wrapError(mRetrofit, e)); } }) .flatMapIterable(new Func1<List<PrayerProvider>, Iterable<PrayerProvider>>() { @Override public Iterable<PrayerProvider> call(List<PrayerProvider> providers) { return providers; } }) .flatMap(new Func1<PrayerProvider, Observable<List<PrayerCode>>>() { @Override public Observable<List<PrayerCode>> call(final PrayerProvider provider) { return Observable.from(provider.codes) .map(new Func1<PrayerCode, PrayerCode>() { @Override public PrayerCode call(PrayerCode c) { c.provider = provider.provider; return c; } }) .toList(); } }); }
RetrofitPrayerClient implements PrayerClient { @Override public Observable<List<PrayerCode>> getSupportedCodes() { return mApi.getSupportedCodes() .onErrorResumeNext(new Func1<Throwable, Observable<? extends List<PrayerProvider>>>() { @Override public Observable<? extends List<PrayerProvider>> call(Throwable e) { return Observable.error(ErrorWrapper.wrapError(mRetrofit, e)); } }) .flatMapIterable(new Func1<List<PrayerProvider>, Iterable<PrayerProvider>>() { @Override public Iterable<PrayerProvider> call(List<PrayerProvider> providers) { return providers; } }) .flatMap(new Func1<PrayerProvider, Observable<List<PrayerCode>>>() { @Override public Observable<List<PrayerCode>> call(final PrayerProvider provider) { return Observable.from(provider.codes) .map(new Func1<PrayerCode, PrayerCode>() { @Override public PrayerCode call(PrayerCode c) { c.provider = provider.provider; return c; } }) .toList(); } }); } }
RetrofitPrayerClient implements PrayerClient { @Override public Observable<List<PrayerCode>> getSupportedCodes() { return mApi.getSupportedCodes() .onErrorResumeNext(new Func1<Throwable, Observable<? extends List<PrayerProvider>>>() { @Override public Observable<? extends List<PrayerProvider>> call(Throwable e) { return Observable.error(ErrorWrapper.wrapError(mRetrofit, e)); } }) .flatMapIterable(new Func1<List<PrayerProvider>, Iterable<PrayerProvider>>() { @Override public Iterable<PrayerProvider> call(List<PrayerProvider> providers) { return providers; } }) .flatMap(new Func1<PrayerProvider, Observable<List<PrayerCode>>>() { @Override public Observable<List<PrayerCode>> call(final PrayerProvider provider) { return Observable.from(provider.codes) .map(new Func1<PrayerCode, PrayerCode>() { @Override public PrayerCode call(PrayerCode c) { c.provider = provider.provider; return c; } }) .toList(); } }); } RetrofitPrayerClient(OkHttpClient client); }
RetrofitPrayerClient implements PrayerClient { @Override public Observable<List<PrayerCode>> getSupportedCodes() { return mApi.getSupportedCodes() .onErrorResumeNext(new Func1<Throwable, Observable<? extends List<PrayerProvider>>>() { @Override public Observable<? extends List<PrayerProvider>> call(Throwable e) { return Observable.error(ErrorWrapper.wrapError(mRetrofit, e)); } }) .flatMapIterable(new Func1<List<PrayerProvider>, Iterable<PrayerProvider>>() { @Override public Iterable<PrayerProvider> call(List<PrayerProvider> providers) { return providers; } }) .flatMap(new Func1<PrayerProvider, Observable<List<PrayerCode>>>() { @Override public Observable<List<PrayerCode>> call(final PrayerProvider provider) { return Observable.from(provider.codes) .map(new Func1<PrayerCode, PrayerCode>() { @Override public PrayerCode call(PrayerCode c) { c.provider = provider.provider; return c; } }) .toList(); } }); } RetrofitPrayerClient(OkHttpClient client); @Override Observable<PrayerData> getPrayerTimesByCode(String code, int year, int month); @Override Observable<PrayerData> getPrayerTimesByCoordinates(double lat, double lng, int year, int month); @Override Observable<List<PrayerCode>> getSupportedCodes(); }
RetrofitPrayerClient implements PrayerClient { @Override public Observable<List<PrayerCode>> getSupportedCodes() { return mApi.getSupportedCodes() .onErrorResumeNext(new Func1<Throwable, Observable<? extends List<PrayerProvider>>>() { @Override public Observable<? extends List<PrayerProvider>> call(Throwable e) { return Observable.error(ErrorWrapper.wrapError(mRetrofit, e)); } }) .flatMapIterable(new Func1<List<PrayerProvider>, Iterable<PrayerProvider>>() { @Override public Iterable<PrayerProvider> call(List<PrayerProvider> providers) { return providers; } }) .flatMap(new Func1<PrayerProvider, Observable<List<PrayerCode>>>() { @Override public Observable<List<PrayerCode>> call(final PrayerProvider provider) { return Observable.from(provider.codes) .map(new Func1<PrayerCode, PrayerCode>() { @Override public PrayerCode call(PrayerCode c) { c.provider = provider.provider; return c; } }) .toList(); } }); } RetrofitPrayerClient(OkHttpClient client); @Override Observable<PrayerData> getPrayerTimesByCode(String code, int year, int month); @Override Observable<PrayerData> getPrayerTimesByCoordinates(double lat, double lng, int year, int month); @Override Observable<List<PrayerCode>> getSupportedCodes();  }