package tyfrontier.cleanarchitecturesample.data.api;

import java.util.List;

import javax.inject.Inject;

import rx.Observable;
import rx.functions.Func1;
import tyfrontier.cleanarchitecturesample.data.api.dto.ArticleDto;
import tyfrontier.cleanarchitecturesample.data.api.mapper.ArticleMapper;
import tyfrontier.cleanarchitecturesample.domain.model.Article;
import tyfrontier.cleanarchitecturesample.domain.net.WebApi;

public class WebApiImpl implements WebApi {

    private static final String BASE_URL = "https://qiita.com/";

    private ApiService apiService = ApiServiceFactory.createRetrofitService(ApiService.class, BASE_URL);

    @Inject
    public WebApiImpl() {
    }

    @Override
    public Observable<List<Article>> getArticles(int page, int perPage) {
        return apiService.getArticles(page, perPage, null).map(new Func1<List<ArticleDto>, List<Article>>() {
            @Override
            public List<Article> call(List<ArticleDto> articleDtos) {
            return new ArticleMapper().map(articleDtos);
            }
        });
    }
}

@@ -827,170 +827,44 @@
 ull)
-.map(new Func1%3CList%3CArticleDto%3E, List%3CArticle%3E%3E() %7B%0A            @Override%0A            public List%3CArticle%3E call(List%3CArticleDto%3E articleDtos) %7B%0A            return
+%0A                .map(articleDtos -%3E
  new
@@ -900,33 +900,8 @@
 tos)
-;%0A            %7D%0A        %7D
 );%0A 

replace with retrolambda