// Path: app/src/main/java/com/camnter/easygank/bean/GankData.java
// public class GankData extends Error implements Serializable {
// 
//     @SerializedName("results") public ArrayList<BaseGankData> results;
// }
// 
// Path: app/src/main/java/com/camnter/easygank/gank/EasyGank.java
// public class EasyGank {
// 
//     private static EasyGank ourInstance;
// 
//     private GankService gankService;
// 
// 
//     public static EasyGank getInstance() {
//         if (ourInstance == null) ourInstance = new EasyGank();
//         return ourInstance;
//     }
// 
// 
//     private EasyGank() {
//         OkHttpClient okHttpClient = new OkHttpClient();
//         okHttpClient.setReadTimeout(7676, TimeUnit.MILLISECONDS);
// 
//         /*
//          * 查看网络请求发送状况
//          */
//         if (EasyApplication.getInstance().log) {
//             okHttpClient.interceptors().add(chain -> {
//                 Response response = chain.proceed(chain.request());
//                 com.orhanobut.logger.Logger.d(chain.request().urlString());
//                 return response;
//             });
//         }
// 
//         Retrofit retrofit = new Retrofit.Builder().baseUrl(GankApi.BASE_URL)
//                                                   .addCallAdapterFactory(
//                                                           RxJavaCallAdapterFactory.create())
//                                                   .addConverterFactory(GsonConverterFactory.create(
//                                                           EasyApplication.getInstance().gson))
//                                                   .client(okHttpClient)
//                                                   .build();
//         this.gankService = retrofit.create(GankService.class);
//     }
// 
// 
//     public GankService getGankService() {
//         return gankService;
//     }
// }
// 
// Path: app/src/main/java/com/camnter/easygank/model/IDataModel.java
// public interface IDataModel {
//     /**
//      * 分页查询( Android、iOS、前端、拓展资源、福利、休息视频 )数据
//      *
//      * @param type 数据类型
//      * @param size 数据个数
//      * @param page 第几页
//      * @return Observable<GankData>
//      */
//     Observable<GankData> getData(String type, int size, int page);
// }


import com.camnter.easygank.bean.GankData;
import com.camnter.easygank.gank.EasyGank;
import com.camnter.easygank.model.IDataModel;
import rx.Observable;
/*
 * {EasyGank}  Copyright (C) {2015}  {CaMnter}
 *
 * This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
 * This is free software, and you are welcome to redistribute it
 * under certain conditions; type `show c' for details.
 *
 * The hypothetical commands `show w' and `show c' should show the appropriate
 * parts of the General Public License.  Of course, your program's commands
 * might be different; for a GUI interface, you would use an "about box".
 *
 * You should also get your employer (if you work as a programmer) or school,
 * if any, to sign a "copyright disclaimer" for the program, if necessary.
 * For more information on this, and how to apply and follow the GNU GPL, see
 * <http://www.gnu.org/licenses/>.
 *
 * The GNU General Public License does not permit incorporating your program
 * into proprietary programs.  If your program is a subroutine library, you
 * may consider it more useful to permit linking proprietary applications with
 * the library.  If this is what you want to do, use the GNU Lesser General
 * Public License instead of this License.  But first, please read
 * <http://www.gnu.org/philosophy/why-not-lgpl.html>.
 */

package com.camnter.easygank.model.impl;


/**
 * Description：DataModel
 * Created by：CaMnter
 * Time：2016-01-06 17:50
 */
public class DataModel implements IDataModel {

    private static final DataModel ourInstance = new DataModel();


    public static DataModel getInstance() {
        return ourInstance;
    }


    private DataModel() {
    }


    /**
     * 分页查询( Android、iOS、前端、拓展资源、福利、休息视频 )数据
     *
     * @param type 数据类型
     * @param size 数据个数
     * @param page 第几页
     * @return Observable<GankData>
     */
    @Override public Observable<GankData> getData(String type, int size, int page) {
// Path: app/src/main/java/com/camnter/easygank/bean/GankData.java
// public class GankData extends Error implements Serializable {
// 
//     @SerializedName("results") public ArrayList<BaseGankData> results;
// }
// 
// Path: app/src/main/java/com/camnter/easygank/gank/EasyGank.java
// public class EasyGank {
// 
//     private static EasyGank ourInstance;
// 
//     private GankService gankService;
// 
// 
//     public static EasyGank getInstance() {
//         if (ourInstance == null) ourInstance = new EasyGank();
//         return ourInstance;
//     }
// 
// 
//     private EasyGank() {
//         OkHttpClient okHttpClient = new OkHttpClient();
//         okHttpClient.setReadTimeout(7676, TimeUnit.MILLISECONDS);
// 
//         /*
//          * 查看网络请求发送状况
//          */
//         if (EasyApplication.getInstance().log) {
//             okHttpClient.interceptors().add(chain -> {
//                 Response response = chain.proceed(chain.request());
//                 com.orhanobut.logger.Logger.d(chain.request().urlString());
//                 return response;
//             });
//         }
// 
//         Retrofit retrofit = new Retrofit.Builder().baseUrl(GankApi.BASE_URL)
//                                                   .addCallAdapterFactory(
//                                                           RxJavaCallAdapterFactory.create())
//                                                   .addConverterFactory(GsonConverterFactory.create(
//                                                           EasyApplication.getInstance().gson))
//                                                   .client(okHttpClient)
//                                                   .build();
//         this.gankService = retrofit.create(GankService.class);
//     }
// 
// 
//     public GankService getGankService() {
//         return gankService;
//     }
// }
// 
// Path: app/src/main/java/com/camnter/easygank/model/IDataModel.java
// public interface IDataModel {
//     /**
//      * 分页查询( Android、iOS、前端、拓展资源、福利、休息视频 )数据
//      *
//      * @param type 数据类型
//      * @param size 数据个数
//      * @param page 第几页
//      * @return Observable<GankData>
//      */
//     Observable<GankData> getData(String type, int size, int page);
// }


// Path: app/src/main/java/com/camnter/easygank/model/impl/DataModel.java
import com.camnter.easygank.bean.GankData;
import com.camnter.easygank.gank.EasyGank;
import com.camnter.easygank.model.IDataModel;
import rx.Observable;

/*
 * {EasyGank}  Copyright (C) {2015}  {CaMnter}
 *
 * This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
 * This is free software, and you are welcome to redistribute it
 * under certain conditions; type `show c' for details.
 *
 * The hypothetical commands `show w' and `show c' should show the appropriate
 * parts of the General Public License.  Of course, your program's commands
 * might be different; for a GUI interface, you would use an "about box".
 *
 * You should also get your employer (if you work as a programmer) or school,
 * if any, to sign a "copyright disclaimer" for the program, if necessary.
 * For more information on this, and how to apply and follow the GNU GPL, see
 * <http://www.gnu.org/licenses/>.
 *
 * The GNU General Public License does not permit incorporating your program
 * into proprietary programs.  If your program is a subroutine library, you
 * may consider it more useful to permit linking proprietary applications with
 * the library.  If this is what you want to do, use the GNU Lesser General
 * Public License instead of this License.  But first, please read
 * <http://www.gnu.org/philosophy/why-not-lgpl.html>.
 */

package com.camnter.easygank.model.impl;


/**
 * Description：DataModel
 * Created by：CaMnter
 * Time：2016-01-06 17:50
 */
public class DataModel implements IDataModel {

    private static final DataModel ourInstance = new DataModel();


    public static DataModel getInstance() {
        return ourInstance;
    }


    private DataModel() {
    }


    /**
     * 分页查询( Android、iOS、前端、拓展资源、福利、休息视频 )数据
     *
     * @param type 数据类型
     * @param size 数据个数
     * @param page 第几页
     * @return Observable<GankData>
     */
    @Override public Observable<GankData> getData(String type, int size, int page) {
        return EasyGank.getInstance().getGankService().getData(type, size, page);